Plugin Directory

Changeset 3294741


Ignore:
Timestamp:
05/16/2025 11:43:24 AM (10 months ago)
Author:
pluginly
Message:

Update to version 1.4.0 from GitHub

Location:
content-restriction
Files:
10 added
4 deleted
62 edited
1 copied

Legend:

Unmodified
Added
Removed
  • content-restriction/tags/1.4.0/app/Admin/Controllers/ModuleController.php

    r3196884 r3294741  
    2222
    2323    public function restrict_view( \WP_REST_Request $request ): array {
    24         $modules = apply_filters( 'content_restriction_restrict_view_module_list', [] );
     24        $modules = apply_filters( 'content_restriction_restrict_view_module_list', [], $request );
    2525
    2626        return $this->filter( $request, $modules );
    2727    }
    2828
     29    /**
     30     * Register Groups for Modules
     31     */
    2932    public function groups(): array {
    3033        return apply_filters( 'content_restriction_module_group_list', [] );
    3134    }
    3235
     36    /**
     37     * Before Sending Response Filter All The Modules
     38     * To Ensure That The Admin Frontend Showing Correct Result
     39     */
    3340    private function filter( \WP_REST_Request $request, array $modules ): array {
    3441        $filter_keys = ['what_content', 'who_can_see', 'restrict_view'];
     
    3643        foreach ( $modules as $key => $module ) {
    3744
     45            /**
     46             * Add selected key to the module
     47             */
    3848            foreach ( $filter_keys as $filter_key ) {
    3949                $param_value = $request->get_param( $filter_key );
     
    4858            $modules[$key] = apply_filters( 'content_restriction_module_condition_check_before', $module, $request );
    4959
    50             if ( ! isset( $module['conditions'] ) ) {
     60            /**
     61             * If the module has no conditions, don't run remaining code.
     62             */
     63            if ( ! isset( $modules[$key]['conditions'] ) ) {
    5164                continue;
    5265            }
    5366
     67            /**
     68             * Check if the current module meets the conditions.
     69             */
    5470            foreach ( $filter_keys as $filter_key ) {
    5571                $param_value      = $request->get_param( $filter_key );
  • content-restriction/tags/1.4.0/app/Admin/Routes/RulesRoute.php

    r3137277 r3294741  
    1717        $this->post( $this->endpoint . '/update', [\ContentRestriction\Admin\Controllers\RuleController::class, 'update'] );
    1818        $this->post( $this->endpoint . '/delete', [\ContentRestriction\Admin\Controllers\RuleController::class, 'delete'] );
     19       
    1920        $this->post( $this->endpoint . '/list', [\ContentRestriction\Admin\Controllers\RuleController::class, 'list'] );
    2021    }
  • content-restriction/tags/1.4.0/app/Boot/App.php

    r3142420 r3294741  
    3838        ( new \ContentRestriction\Providers\AdminServiceProviders() )->boot();
    3939        ( new \ContentRestriction\Providers\FrontendServiceProviders() )->boot();
     40        ( new \ContentRestriction\Modules\Shortcode\ServiceProvider )->boot();
    4041        ( new \ContentRestriction\Providers\IntegrationServiceProviders() )->boot();
    4142        ( new \ContentRestriction\Providers\RestrictionServiceProviders )->boot();
  • content-restriction/tags/1.4.0/app/Models/RuleModel.php

    r3137277 r3294741  
    7878        );
    7979    }
     80
     81    public function get( $id ) {
     82        $query = $this->wpdb->prepare(
     83            "SELECT * FROM {$this->table} WHERE id = %d",
     84            $id
     85        );
     86
     87        $result = $this->wpdb->get_row( $query, ARRAY_A );
     88
     89        return $result;
     90    }
    8091}
  • content-restriction/tags/1.4.0/app/Modules/Blur/Blur.php

    r3137277 r3294741  
    88namespace ContentRestriction\Modules\Blur;
    99
     10use ContentRestriction\Utils\Random;
     11
    1012class Blur extends \ContentRestriction\Common\RestrictViewBase {
    1113
     
    1618        $this->who_can_see  = $who_can_see;
    1719        $this->what_content = $what_content;
    18         $this->options      = $this->rule['rule'][$this->type][$this->module] ?? [];
    19         $this->protection   = new Protection( $what_content, $this->options, $this->rule );
     20        $this->options      = $rule['rule'][$this->type][$this->module] ?? [];
    2021    }
    2122
     23    /**
     24     * Initializes blur protection on restricted content if access is denied.
     25     */
    2226    public function boot(): void {
    23         $if = ( new $this->who_can_see( $this->rule ) );
    24         if ( $if->has_access() ) {
     27        /**
     28         * Allow developers to intervene before applying content blur,
     29         * using the 'content_restriction_blur_before' filter. If any
     30         * callback returns false, stop further processing.
     31         *
     32         * @param bool  $continue Whether to proceed with content blur.
     33         * @param self  $this     Current instance of the restriction handler.
     34         */
     35        if ( ! apply_filters( 'content_restriction_blur_before', true, $this ) ) {
    2536            return;
    2637        }
    2738
    28         add_filter( 'content_restriction_the_title', [$this, 'the_title'], 10 );
    29         add_filter( 'content_restriction_the_excerpt', [$this, 'the_excerpt'], 1 );
    30         add_filter( 'content_restriction_the_content', [$this, 'the_content'] );
     39        $who_can_see = new $this->who_can_see( $this->rule );
     40        if ( $who_can_see->has_access() ) {
     41            return;
     42        }
     43
     44        // Hook into all three filters
     45        add_filter( 'content_restriction_the_title', [$this, 'modify_content'], 10 );
     46        add_filter( 'content_restriction_the_excerpt', [$this, 'modify_content'], 1 );
     47        add_filter( 'content_restriction_the_content', [$this, 'modify_content'] );
    3148    }
    3249
    33     public function the_title( $title ) {
    34         \ContentRestriction\Utils\Analytics::add( [
    35             'user_id' => get_current_user_id(),
    36             'post_id' => get_the_ID(),
    37             'context' => 'locked',
    38             'id'      => $this->rule['id'],
    39         ] );
    40 
    41         $this->protection->set_post_id( get_the_ID() );
    42 
    43         if ( $this->apply_to( 'title' ) ) {
    44             $title = $this->protection->add( $title );
     50    /**
     51     * Applies blur protection to title, excerpt, or content based on settings.
     52     */
     53    public function modify_content( $content, $type = '' ): string {
     54        switch ( current_filter() ) {
     55            case 'content_restriction_the_title':
     56                $type = 'title';
     57                break;
     58            case 'content_restriction_the_excerpt':
     59                $type = 'excerpt';
     60                break;
     61            case 'content_restriction_the_content':
     62                $type = 'content';
     63                break;
    4564        }
    4665
    47         return $title;
     66        if ( ! $type || ! $this->should_apply( $type ) ) {
     67            return $content;
     68        }
     69
     70        $this->post_id = get_the_ID();
     71
     72        return $this->add_protection( $content );
    4873    }
    4974
    50     public function the_excerpt( $excerpt ) {
    51         if ( $this->apply_to( 'excerpt' ) ) {
    52             $excerpt = $this->protection->add( $excerpt );
     75    public function add_protection( $content ) {
     76        if ( ! $this->is_allowed() ) {
     77            return $content;
    5378        }
    5479
    55         return $excerpt;
     80        $html_tag      = 'div';
     81        $add_rand_text = apply_filters( 'content_restriction_blur_protection_rand_text', true );
     82        if ( $add_rand_text ) {
     83            $content = Random::randomize( $content );
     84        }
     85
     86        $blur_level = $this->options['level'] ?? 10;
     87        $spread     = $this->options['spread'] ?? 10;
     88
     89        return sprintf(
     90            '<%s class="aiocr-blur" style="-webkit-filter: blur(%spx); text-shadow: 0 0 %spx #000;">%s</%s>',
     91            $html_tag,
     92            esc_attr( $blur_level ),
     93            esc_attr( $spread ),
     94            $content,
     95            $html_tag
     96        );
    5697    }
    5798
    58     public function the_content( $content ) {
    59         if ( $this->apply_to( 'content' ) ) {
    60             $content = $this->protection->add( $content );
    61         }
    62 
    63         return $content;
    64     }
    65 
    66     private function apply_to( string $t ): bool {
    67         $arr = $this->options['apply_to'] ?? [];
    68         if ( in_array( $t, $arr ) ) {
     99    private function is_allowed(): bool {
     100        $what_content = new $this->what_content( $this->rule );
     101        $what_content->set_post_id( $this->post_id );
     102        if ( $what_content->protect() ) {
    69103            return true;
    70104        }
     
    72106        return false;
    73107    }
     108
     109    /**
     110     * Determines whether blur should be applied to a given content type.
     111     */
     112    private function should_apply( string $type ): bool {
     113        return in_array( $type, $this->options['apply_to'] ?? [], true );
     114    }
    74115}
  • content-restriction/tags/1.4.0/app/Modules/Blur/Frontend.php

    r3137277 r3294741  
    2222            'desc'       => __( 'Blur title, excerpt and description.', 'content-restriction' ),
    2323            'type'       => 'section',
     24            'group'      => 'wordpress',
    2425            'options'    => [
    2526                'apply_to' => [
     
    5455                        'specific_pages',
    5556                        'frontpage',
     57                        'shortcode'
    5658                    ],
    5759                    'compare'      => 'has_any',
  • content-restriction/tags/1.4.0/app/Modules/Hide/Frontend.php

    r3137277 r3294741  
    1818    public function list( array $modules ): array {
    1919        $modules[] = [
    20             'name' => __( 'Hide', 'content-restriction' ),
    21             'key'  => 'hide',
    22             'icon' => $this->get_icon( 'Hide' ),
    23             'desc' => __( 'Hide entirely.', 'content-restriction' ),
     20            'name'  => __( 'Hide', 'content-restriction' ),
     21            'key'   => 'hide',
     22            'icon'  => $this->get_icon( 'Hide' ),
     23            'desc'  => __( 'Hide entirely.', 'content-restriction' ),
     24            'group' => 'wordpress',
    2425        ];
    2526
  • content-restriction/tags/1.4.0/app/Modules/LoginBack/Frontend.php

    r3144029 r3294741  
    2222            'icon'       => $this->get_icon( 'LoginBack' ),
    2323            'desc'       => __( 'Redirect back to the current post or page after the user logged in.', 'content-restriction' ),
     24            'group'      => 'wordpress',
    2425            'conditions' => apply_filters(
    2526                'content_restriction_module_login_and_back_conditions',
  • content-restriction/tags/1.4.0/app/Modules/Pages/Frontend.php

    r3137277 r3294741  
    1818    public function list( array $modules ): array {
    1919        $modules[] = [
    20             'name' => __( 'All Pages', 'content-restriction' ),
    21             'key'  => 'all_pages',
    22             'icon' => $this->get_icon( 'WordPress' ),
    23             'desc' => __( 'All the pages will be accessible when the set rule is applied.', 'content-restriction' ),
     20            'name'  => __( 'All Pages', 'content-restriction' ),
     21            'key'   => 'all_pages',
     22            'icon'  => $this->get_icon( 'WordPress' ),
     23            'desc'  => __( 'All the pages will be accessible when the set rule is applied.', 'content-restriction' ),
     24            'group' => 'wordpress',
    2425        ];
    2526
     
    3031            'desc'    => __( 'Specific page will be accessible when the set rule is applied.', 'content-restriction' ),
    3132            'type'    => 'section',
     33            'group'   => 'wordpress',
    3234            'options' => [
    3335                'pages' => [
     
    4042
    4143        $modules[] = [
    42             'name' => __( 'Frontpage', 'content-restriction' ),
    43             'key'  => 'frontpage',
    44             'icon' => $this->get_icon( 'WordPress' ),
    45             'desc' => __( 'Frontpage will be accessible when the set rule is applied.', 'content-restriction' ),
     44            'name'  => __( 'Frontpage', 'content-restriction' ),
     45            'key'   => 'frontpage',
     46            'icon'  => $this->get_icon( 'WordPress' ),
     47            'desc'  => __( 'Frontpage will be accessible when the set rule is applied.', 'content-restriction' ),
     48            'group' => 'wordpress',
    4649        ];
    4750
  • content-restriction/tags/1.4.0/app/Modules/Posts/Frontend.php

    r3137277 r3294741  
    1818    public function list( array $modules ): array {
    1919        $modules[] = [
    20             'name' => __( 'All Posts', 'content-restriction' ),
    21             'key'  => 'all_posts',
    22             'icon' => $this->get_icon( 'WordPress' ),
    23             'desc' => __( 'All the posts will be accessible when the set rule is applied.', 'content-restriction' ),
     20            'name'  => __( 'All Posts', 'content-restriction' ),
     21            'key'   => 'all_posts',
     22            'icon'  => $this->get_icon( 'WordPress' ),
     23            'desc'  => __( 'All the posts will be accessible when the set rule is applied.', 'content-restriction' ),
     24            'group' => 'wordpress',
    2425        ];
    2526
     
    3031            'desc'    => __( 'Specific post will be accessible when the set rule is applied.', 'content-restriction' ),
    3132            'type'    => 'section',
     33            'group'   => 'wordpress',
    3234            'options' => [
    3335                'posts' => [
     
    4547            'desc'    => __( 'Post with the category will be accessible when the set rule is applied.', 'content-restriction' ),
    4648            'type'    => 'section',
     49            'group'   => 'wordpress',
    4750            'options' => [
    4851                'categories' => [
     
    6063            'desc'    => __( 'Post with the tag will be accessible when the set rule is applied.', 'content-restriction' ),
    6164            'type'    => 'section',
     65            'group'   => 'wordpress',
    6266            'options' => [
    6367                'tags' => [
  • content-restriction/tags/1.4.0/app/Modules/Randomize/Frontend.php

    r3142420 r3294741  
    2121            'desc'       => __( 'Randomize words in the post or page title, excerpt, and description.', 'content-restriction' ),
    2222            'type'       => 'section',
     23            'group'      => 'wordpress',
    2324            'options'    => [
    2425                'apply_to' => [
     
    4142                    'specific_pages',
    4243                    'frontpage',
     44                    'shortcode'
    4345                ],
    4446                'compare'      => 'has_any',
  • content-restriction/tags/1.4.0/app/Modules/Redirection/Frontend.php

    r3142420 r3294741  
    2323            'desc'    => __( 'Redirect to any URL.', 'content-restriction' ),
    2424            'type'    => 'section',
     25            'group'   => 'wordpress',
    2526            'options' => [
    2627                'url' => [
  • content-restriction/tags/1.4.0/app/Modules/Replace/Frontend.php

    r3137277 r3294741  
    2323            'desc'       => __( 'Replace title, excerpt, and description with custom message.', 'content-restriction' ),
    2424            'type'       => 'section',
     25            'group'      => 'wordpress',
    2526            'options'    => [
    2627                'title'   => [
  • content-restriction/tags/1.4.0/app/Modules/Replace/Replace.php

    r3137277 r3294741  
    88namespace ContentRestriction\Modules\Replace;
    99
     10use ContentRestriction\Utils\Analytics;
     11
    1012class Replace extends \ContentRestriction\Common\RestrictViewBase {
    1113
     
    1618        $this->who_can_see  = $who_can_see;
    1719        $this->what_content = $what_content;
    18         $this->options      = $this->rule['rule'][$this->type][$this->module] ?? [];
    19         $this->protection   = new Protection( $what_content, $this->options, $this->rule );
     20        $this->options      = $rule['rule'][$this->type][$this->module] ?? [];
    2021    }
    2122
     23    /**
     24     * Initializes content restriction checks and applies modifications as needed.
     25     */
    2226    public function boot(): void {
    23         $if = ( new $this->who_can_see( $this->rule ) );
    24         if ( $if->has_access() ) {
     27
     28        /**
     29         * Allow developers to intervene before applying content replacement,
     30         * using the 'content_restriction_replace_before' filter. If any
     31         * callback returns false, stop further processing.
     32         *
     33         * @param bool  $continue Whether to proceed with content replacement.
     34         * @param self  $this     Current instance of the restriction handler.
     35         */
     36        if ( ! apply_filters( 'content_restriction_replace_before', true, $this ) ) {
    2537            return;
    2638        }
    2739
    28         \ContentRestriction\Utils\Analytics::add( [
     40        // Exit early if the current user has access to the restricted content
     41        $who_can_see = new $this->who_can_see( $this->rule );
     42        if ( $who_can_see->has_access() ) {
     43            return;
     44        }
     45
     46        // Log that the user encountered restricted content
     47        Analytics::add( [
    2948            'user_id' => get_current_user_id(),
    3049            'context' => 'locked',
     
    3251        ] );
    3352
    34         add_filter( 'content_restriction_the_title', [$this, 'the_title'], 10 );
    35         add_filter( 'content_restriction_the_excerpt', [$this, 'the_excerpt'], 1 );
    36         add_filter( 'content_restriction_the_content', [$this, 'the_content'] );
     53        // Attach filters to modify restricted content areas as specified by the rule
     54        add_filter( 'content_restriction_the_title', [$this, 'modify_content'], 10 );
     55        add_filter( 'content_restriction_the_excerpt', [$this, 'modify_content'], 1 );
     56        add_filter( 'content_restriction_the_content', [$this, 'modify_content'], 10 );
    3757    }
    3858
    39     public function the_title( $title ) {
    40         $this->protection->set_post_id( get_the_ID() );
    41 
    42         $override = $this->apply_to( 'title' );
    43         if ( ! empty( $override ) ) {
    44             $title = $this->protection->add( $title, $override );
     59    public function modify_content( $content ): string {
     60        switch ( current_filter() ) {
     61            case 'content_restriction_the_title':
     62                $type = 'title';
     63                break;
     64            case 'content_restriction_the_excerpt':
     65                $type = 'excerpt';
     66                break;
     67            case 'content_restriction_the_content':
     68                $type = 'content';
     69                break;
    4570        }
    4671
    47         return $title;
     72        $this->post_id = get_the_ID() ?: 0;
     73        $override      = (string) $this->options[$type] ?? '';
     74
     75        return ! empty( $override ) ? $this->add_protection( $content, $override ) : $content;
    4876    }
    4977
    50     public function the_excerpt( $excerpt ) {
    51         $override = $this->apply_to( 'excerpt' );
    52         if ( $override ) {
    53             $excerpt = $this->protection->add( $excerpt, $override );
     78    private function add_protection( string $content, string $override ) {
     79        if ( ! $this->is_allowed() ) {
     80            return $content;
    5481        }
    5582
    56         return $excerpt;
     83        return $override;
    5784    }
    5885
    59     public function the_content( $content ) {
    60         $override = $this->apply_to( 'content' );
    61         if ( $override ) {
    62             $content = $this->protection->add( $content, $override );
     86    private function is_allowed(): bool {
     87        $what_content = new $this->what_content( $this->rule );
     88        $what_content->set_post_id( $this->post_id );
     89        if ( $what_content->protect() ) {
     90            return true;
    6391        }
    6492
    65         return $content;
    66     }
    67 
    68     private function apply_to( string $t ) {
    69         if ( isset( $this->options[$t] ) ) {
    70             return $this->options[$t];
    71         }
    72 
    73         return '';
     93        return false;
    7494    }
    7595}
  • content-restriction/tags/1.4.0/app/Modules/WordPressUsers/Frontend.php

    r3137277 r3294741  
    2424            'desc'    => __( 'Select who should have access to the content.', 'content-restriction' ),
    2525            'type'    => 'section',
     26            'group'   => 'wordpress',
    2627            'options' => [
    2728                'roles' => [
     
    4041            'desc'    => __( 'Select who should have access to the content.', 'content-restriction' ),
    4142            'type'    => 'section',
     43            'group'   => 'wordpress',
    4244            'options' => [
    4345                'users' => [
     
    5052
    5153        $modules[] = [
    52             'name' => __( 'Logged In User', 'content-restriction' ),
    53             'key'  => 'user_logged_in',
    54             'icon' => $this->get_icon( 'WordPress' ),
    55             'desc' => __( 'Only logged in user should have access to the content.', 'content-restriction' ),
     54            'name'  => __( 'Logged In User', 'content-restriction' ),
     55            'key'   => 'user_logged_in',
     56            'icon'  => $this->get_icon( 'WordPress' ),
     57            'desc'  => __( 'Only logged in user should have access to the content.', 'content-restriction' ),
     58            'group' => 'wordpress',
    5659        ];
    5760
    5861        $modules[] = [
    59             'name' => __( 'Logged Out User', 'content-restriction' ),
    60             'key'  => 'user_not_logged_in',
    61             'icon' => $this->get_icon( 'WordPress' ),
    62             'desc' => __( 'Only logged out user should have access to the content.', 'content-restriction' ),
     62            'name'  => __( 'Logged Out User', 'content-restriction' ),
     63            'key'   => 'user_not_logged_in',
     64            'icon'  => $this->get_icon( 'WordPress' ),
     65            'desc'  => __( 'Only logged out user should have access to the content.', 'content-restriction' ),
     66            'group' => 'wordpress',
    6367        ];
    6468
  • content-restriction/tags/1.4.0/app/Providers/FrontendServiceProviders.php

    r3142420 r3294741  
    2525            \ContentRestriction\Modules\LoginBack\Frontend::class,
    2626            \ContentRestriction\Modules\Replace\Frontend::class,
     27            \ContentRestriction\Modules\Shortcode\Frontend::class,
    2728            \ContentRestriction\Modules\Pages\Frontend::class,
    2829            \ContentRestriction\Modules\Posts\Frontend::class,
  • content-restriction/tags/1.4.0/app/Providers/RestrictionServiceProviders.php

    r3137277 r3294741  
    1616        }
    1717
     18        // Flow - Restrict View > Who Can See > What Content
     19
    1820        /**
    1921         * Blur, Randomize, & Replace
     
    2426
    2527        /**
    26          *  Hide
     28         * Hide
    2729         */
    2830        add_action( 'pre_get_posts', [$this, 'pre_get_posts'], 110 );
  • content-restriction/tags/1.4.0/app/Repositories/ModuleRepository.php

    r3142420 r3294741  
    33 * @package ContentRestriction
    44 * @since   1.0.0
    5  * @version 1.0.0
     5 * @version 1.4.0
    66 */
    77
     
    1010class ModuleRepository {
    1111    private array $restrictions;
     12    public static array $modules;
    1213
    1314    public function __construct() {
    14         $this->restrictions = $this->get_restrictions();
    15     }
    16 
    17     public function has_restrictions() {
    18         if ( empty( $this->restrictions ) ) {
    19             return false;
    20         }
    21 
    22         return true;
    23     }
    24 
    25     private function get_restrictions(): array {
    26         if ( isset( $this->restrictions ) ) {
    27             return $this->restrictions;
    28         }
    29 
    30         return ( new RuleRepository() )->get_all();
     15        $this->restrictions = $this->fetch_restrictions();
    3116    }
    3217
    3318    /**
    34      * Based on the restrictions,
    35      * Load respective modules
     19     * Checks if any restrictions are defined.
     20     *
     21     * @return bool True if restrictions are present; false otherwise.
    3622     */
    37     public function load() {
     23    public function has_restrictions(): bool {
     24        return ! empty( $this->restrictions );
     25    }
     26
     27    /**
     28     * Retrieves all restriction rules.
     29     *
     30     * @return array List of restriction rules.
     31     */
     32    private function fetch_restrictions(): array {
     33        return $this->restrictions ?? ( new RuleRepository() )->get_all();
     34    }
     35
     36    /**
     37     * Loads and initializes applicable restriction modules based on active rules.
     38     */
     39    public function load(): void {
     40        // Exit if running in admin mode to prevent frontend restrictions from affecting admin
    3841        if ( is_admin() ) {
    3942            return;
    4043        }
    4144
    42         foreach ( $this->restrictions as $key => $rule ) {
    43             if ( ! isset( $rule['status'] ) || ! $rule['status'] ) {
     45        // Get available restriction modules once for efficiency
     46        self::$modules = $this->get_modules();
     47
     48        // Iterate through each restriction rule
     49        foreach ( $this->restrictions as $rule ) {
     50            // Skip rule if it's inactive or invalid
     51            if ( empty( $rule['status'] ) || ! self::is_valid_rule( $rule['rule'] ) ) {
    4452                continue;
    4553            }
    4654
    47             if (
    48                 ! isset( $rule['rule']['who-can-see'] ) ||
    49                 ! isset( $rule['rule']['what-content'] ) ||
    50                 ! isset( $rule['rule']['restrict-view'] ) ) {
    51                 continue;
    52             }
     55            // Resolve modules for "who can see," "what content," and "restrict view"
     56            $who_can_see   = self::resolve_rule_module( $rule['rule']['who-can-see'] );
     57            $what_content  = self::resolve_rule_module( $rule['rule']['what-content'] );
     58            $restrict_view = self::resolve_rule_module( $rule['rule']['restrict-view'] );
    5359
    54             $who_can_see   = is_array( $rule['rule']['who-can-see'] ) ? array_key_first( $rule['rule']['who-can-see'] ) : $rule['rule']['who-can-see'];
    55             $what_content  = is_array( $rule['rule']['what-content'] ) ? array_key_first( $rule['rule']['what-content'] ) : $rule['rule']['what-content'];
    56             $restrict_view = is_array( $rule['rule']['restrict-view'] ) ? array_key_first( $rule['rule']['restrict-view'] ) : $rule['rule']['restrict-view'];
     60            // Check that all required modules exist in the loaded modules array
     61            if ( isset( self::$modules[$who_can_see], self::$modules[$what_content], self::$modules[$restrict_view] ) ) {
    5762
    58             $modules        = $this->get();
    59             $_who_can_see   = $modules[$who_can_see] ?? '';
    60             $_what_content  = $modules[$what_content] ?? '';
    61             $_restrict_view = $modules[$restrict_view] ?? '';
     63                // Initialize and boot the restriction view module with resolved modules
     64                $restriction_module = new self::$modules[$restrict_view](
     65                    self::$modules[$who_can_see],
     66                    self::$modules[$what_content],
     67                    $rule
     68                );
    6269
    63             if ( $_who_can_see && $_what_content && $_restrict_view ) {
    64                 ( new $_restrict_view( $_who_can_see, $_what_content, $rule ) )->boot();
     70                $restriction_module->boot();
    6571            }
    6672        }
     
    6874
    6975    /**
    70      * To add more modules,
    71      * use the @hook `content_restriction_load_modules`
     76     * Retrieves all module class mappings with an option for additional modules via hooks.
     77     *
     78     * @return array List of available module classes.
    7279     */
    73     private function get() {
     80    private function get_modules(): array {
    7481        return apply_filters(
    7582            'content_restriction_load_modules',
    7683            [
     84                // Restriction Types
    7785                'blur'                  => \ContentRestriction\Modules\Blur\Blur::class,
    7886                'hide'                  => \ContentRestriction\Modules\Hide\Hide::class,
     
    8189                'redirection'           => \ContentRestriction\Modules\Redirection\Redirection::class,
    8290
     91                // Content Types
    8392                'all_pages'             => \ContentRestriction\Modules\Pages\AllPages::class,
    8493                'specific_pages'        => \ContentRestriction\Modules\Pages\SpecificPages::class,
    8594                'frontpage'             => \ContentRestriction\Modules\Pages\Frontpage::class,
    8695
     96                // Post Types
    8797                'all_posts'             => \ContentRestriction\Modules\Posts\AllPosts::class,
    8898                'specific_posts'        => \ContentRestriction\Modules\Posts\SpecificPosts::class,
     
    90100                'posts_with_tags'       => \ContentRestriction\Modules\Posts\PostsWithTags::class,
    91101
     102                'shortcode'             => \ContentRestriction\Modules\Shortcode\Shortcode::class,
     103
     104                // User Types
    92105                'selected_roles'        => \ContentRestriction\Modules\WordPressUsers\SelectedRoles::class,
    93106                'selected_users'        => \ContentRestriction\Modules\WordPressUsers\SelectedUsers::class,
     
    97110        );
    98111    }
     112
     113    /**
     114     * Verifies the rule's structure to ensure required modules are set.
     115     *
     116     * @param array $rule Rule data array.
     117     * @return bool True if the rule is valid; false otherwise.
     118     */
     119    public static function is_valid_rule( array $rule ): bool {
     120        return isset(
     121            $rule['who-can-see'],
     122            $rule['what-content'],
     123            $rule['restrict-view']
     124        );
     125    }
     126
     127    /**
     128     * Retrieves the primary key of a rule module, handling array structures if needed.
     129     *
     130     * @param mixed $module Rule module data, potentially an array.
     131     * @return string|null Primary key of the module or null if undefined.
     132     */
     133    public static function resolve_rule_module( $module ): ?string {
     134        return is_array( $module ) ? array_key_first( $module ) : $module;
     135    }
     136
     137    /**
     138     * Get Specific Module by key
     139     */
     140    public static function get_module( string $key ) {
     141        return self::$modules[$key] ?? '';
     142    }
    99143}
  • content-restriction/tags/1.4.0/app/Repositories/RuleRepository.php

    r3180815 r3294741  
    6868    }
    6969
     70    public function get( string $id ): array {
     71        // Fetch the rule by id using RuleModel
     72        $rule = ( new RuleModel )->get( $id );
     73
     74        // Return an empty array if no rule is found
     75        if ( ! $rule ) {
     76            return [];
     77        }
     78
     79        // Format the retrieved rule to match the structure used in get_all()
     80        $rule['status']     = (bool) $rule['status'];
     81        $rule['modified']   = strtotime( $rule['modified'] );
     82        $rule['created_at'] = strtotime( $rule['created_at'] );
     83
     84        $rule['rule']['who-can-see']   = maybe_unserialize( $rule['who_can_see'] );
     85        $rule['rule']['what-content']  = maybe_unserialize( $rule['what_content'] );
     86        $rule['rule']['restrict-view'] = maybe_unserialize( $rule['restrict_view'] );
     87
     88        unset( $rule['who_can_see'] );
     89        unset( $rule['what_content'] );
     90        unset( $rule['restrict_view'] );
     91
     92        return $rule;
     93    }
     94
    7095    public function get_all(): array {
    7196        $rules = ( new RuleModel )->get_all();
  • content-restriction/tags/1.4.0/app/Utils/Logger.php

    r3147717 r3294741  
    99class Logger {
    1010    public static function add( $data, string $prefix = '' ) {
    11         error_log( $prefix . ' : ' . print_r( $data, true ) );
     11        if ( defined( 'WP_DEBUG' ) && WP_DEBUG ) {
     12            error_log( $prefix . ' : ' . print_r( $data, true ) );
     13        }
    1214    }
    1315}
  • content-restriction/tags/1.4.0/assets/704.css

    r3180815 r3294741  
    11.react-tabs{-webkit-tap-highlight-color:transparent}.react-tabs__tab-list{border-bottom:1px solid #aaa;margin:0 0 10px;padding:0}.react-tabs__tab{border:1px solid transparent;border-bottom:none;bottom:-1px;cursor:pointer;display:inline-block;list-style:none;padding:6px 12px;position:relative}.react-tabs__tab--selected{background:#fff;border-color:#aaa;border-radius:5px 5px 0 0;color:#000}.react-tabs__tab--disabled{color:GrayText;cursor:default}.react-tabs__tab:focus{outline:none}.react-tabs__tab:focus:after{background:#fff;bottom:-5px;content:"";height:5px;left:-4px;position:absolute;right:-4px}.react-tabs__tab-panel{display:none}.react-tabs__tab-panel--selected{display:block}
    2 .content-restriction__rules{min-height:calc(70vh - 80px);padding:30px 20px}.content-restriction__rules__header{align-items:center;display:flex;justify-content:space-between;padding:50px 25px 25px}.content-restriction__rules__header__title{font-size:32px;font-weight:700}.content-restriction__rules__list{background-color:#fff!important;border-radius:var(--content-restriction-border-radius);border-spacing:unset;padding:40px;width:100%}.content-restriction__rules__list__header th{border-bottom:2px solid #ccc;color:#000;font-size:14px;font-weight:700;padding:16px 5px!important;text-align:start}.content-restriction__rules__list__header th:first-child{padding-inline-start:0}.content-restriction__rules__body td{border-bottom:1px solid #ccc;box-sizing:border-box;color:#000;font-size:14px;font-weight:400;height:55px;padding:16px 5px!important}.content-restriction__rules__body td:last-child{justify-content:flex-end;padding-inline-end:0}.content-restriction__rules__body td:first-child{padding-inline-start:0}.content-restriction__rules__body a{align-items:center;color:#000;display:flex;font-size:14px;font-weight:500;gap:10px;text-decoration:none}.content-restriction__rules__body a:hover{color:var(--content-restriction-primary-color)}.content-restriction__rules__icon{display:flex;gap:5px}.content-restriction__rules__action{display:flex;gap:20px}.content-restriction__rules__action a{border:none;box-shadow:none}.content-restriction__rules__action .delete-btn svg path,.content-restriction__rules__action a svg path{fill:var(--content-restriction-primary-color)}.content-restriction__create-rules{align-items:center;display:flex;flex-direction:column;gap:70px;justify-content:center;min-height:calc(90vh - 80px)}.content-restriction__single{position:relative}.content-restriction__single__btn{align-items:center;background-color:#fff;border-radius:var(--content-restriction-border-radius);box-sizing:border-box;color:#000;cursor:pointer;display:flex;font-size:16px;font-weight:700;gap:10px;padding:12px 20px;position:relative;transition:all .3s ease;width:385px}.content-restriction__single__btn img{border-radius:var(--content-restriction-border-radius);box-shadow:0 0 3px #ddd;flex:1;max-width:25px;padding:6px 8px}.content-restriction__single__btn__title{flex:1;font-size:16px;margin:0}.content-restriction__single__btn__action{height:100%;text-align:end}.content-restriction__single__btn:hover{box-shadow:0 5px 10px 0 rgba(0,0,0,.1)}.content-restriction__single__btn.disabled{opacity:.5;pointer-events:none}.content-restriction__single__btn__dropdown{box-shadow:0 0 15px rgba(0,0,0,.082);inset-inline-start:100%;margin:0;opacity:0;position:absolute;top:0;transform:translateY(-10px);transition:all .3s ease;visibility:hidden;width:125px;z-index:1}.content-restriction__single__btn__dropdown.active{opacity:1;transform:translateY(0);visibility:visible}.content-restriction__single__btn__dropdown__item{cursor:auto;margin:0}.content-restriction__single__btn__dropdown__btn{background-color:#fff;color:#000;font-size:14px;padding:8px 25px;transition:all .3s ease;width:100%}.content-restriction__single__btn__dropdown__btn:hover{box-shadow:0 5px 10px 0 rgba(0,0,0,.1)}.content-restriction__single__btn__dropdown__btn.disabled{color:#95928e;pointer-events:none}.content-restriction__single__btn__dropdown__btn--delete{border-radius:var(--content-restriction-border-radius);color:#f5f5f5;padding:12px 25px}.content-restriction__single__btn__dropdown__btn--delete,.content-restriction__single__btn__dropdown__btn--delete:hover{background-color:var(--content-restriction-primary-color)}.content-restriction__single:before{align-items:center;border-radius:100%;content:"Then Unlock";display:flex;font-size:15px;height:20px;justify-content:center;left:50%;position:absolute;top:calc(100% + 28px);transform:translateX(calc(-50% + 1px));width:200px;z-index:1}.content-restriction__single:nth-child(2):before{content:"Otherwise, Restrict Using"}.content-restriction__single:after{border-right:2px dashed #d7d5d2;content:"";height:70px;left:50%;position:absolute;top:100%;transform:translateX(-50%);width:2px}.content-restriction__single:last-child:after,.content-restriction__single:last-child:before{display:none}.content-restriction__modal{pointer-events:none}.content-restriction__modal__overlay{background-color:rgba(0,0,0,.5);height:100%;left:0;opacity:0;position:fixed;top:0;transition:opacity .5s;width:100%;z-index:2}.content-restriction__modal__content{border-radius:var(--content-restriction-border-radius);display:flex;flex-direction:column;left:50%;max-height:550px;max-width:900px;opacity:0;overflow-y:auto;position:absolute;top:50%;transform:translate(-50%,-50%) scale(.9);transition:opacity .3s,transform .5s;width:100%;z-index:2}.content-restriction__modal__content__title{margin:10px 0}.content-restriction__modal__content__desc{margin-bottom:0}.content-restriction__modal__content__header{background:#1f3121;display:flex;gap:20px;justify-content:space-between;padding:20px}.content-restriction__modal__content__header__info{align-items:center;display:flex;gap:10px}.content-restriction__modal__content__header__info .info-icon{background:#fff;border-radius:var(--content-restriction-border-radius);padding:10px}.content-restriction__modal__content__header__action{align-items:center;display:flex;gap:10px}.content-restriction__modal__content__header__action__btn{align-items:center;background-color:transparent;border:1px solid #fff;border-radius:var(--content-restriction-border-radius);color:#fff;display:flex;font-size:14px;font-weight:500;gap:10px;justify-content:center;padding:10px 25px;text-decoration:none;transition:all .3s ease;white-space:nowrap}.content-restriction__modal__content__header__action__btn:hover{background-color:#fff;border-color:#fff;color:#000}.content-restriction__modal__content__title{color:#fff;font-size:24px;font-weight:700}.content-restriction__modal__content__desc{color:#fff;font-size:14px;font-weight:400}.content-restriction__modal__content__btn{align-items:center;background-color:#fff;border-radius:var(--content-restriction-border-radius);color:#000;cursor:pointer;display:flex;justify-content:center;padding:10px 25px}.content-restriction__modal__content__close-btn{align-items:center;border-radius:50%;color:#fff;cursor:pointer;display:flex;font-size:20px;height:30px;justify-content:center;width:30px}.content-restriction__modal__content__body{background:#fff;color:#000;font-size:16px;font-weight:400}.content-restriction__modal__content__wrapper{align-items:flex-start;display:flex}.content-restriction__modal--visible{pointer-events:auto}.content-restriction__modal--visible .content-restriction__modal__content,.content-restriction__modal--visible .content-restriction__modal__overlay{opacity:1}.content-restriction__modal--visible .content-restriction__modal__content{opacity:1;transform:translate(-50%,-50%) scale(1)}.content-restriction__module{display:flex;flex:1;flex-direction:column;gap:15px;padding:15px}.content-restriction__type{align-items:center;display:flex;flex-wrap:wrap;gap:5px;margin-top:0}.content-restriction__type__item{flex:0 0 32.94%;margin:0}.content-restriction__type .pro-item .pro-badge,.content-restriction__type .pro-item .upcoming-badge{font-size:12px;padding:3px 8px;position:absolute;right:15px;text-align:right}.content-restriction__type .pro-item .upcoming-badge{background:#93003f;background:#ecfdf5;border-radius:100px;color:#fff;color:#047857}.content-restriction__type .pro-item{position:relative}.content-restriction__type__btn{align-content:baseline;align-items:center;border:1px solid #e6e6e6;border-radius:var(--content-restriction-border-radius);color:#000;display:flex;flex-direction:column;flex-wrap:wrap;flex-flow:column;font-size:15px;font-weight:600;min-height:205px;padding:15px;transition:all .3s ease;white-space:nowrap;width:100%}.content-restriction__type__btn h3{font-size:1.1em}.content-restriction__type__btn img{border-radius:var(--content-restriction-border-radius);margin-right:5px;max-width:40px;padding:2px}.content-restriction__type__btn span{font-weight:400;line-height:1.6;text-align:center;white-space:normal}.content-restriction__type__btn:hover{border-color:#d1cdcd;box-shadow:0 10px 15px 5px rgba(0,0,0,.1)}.content-restriction__sidebar{pointer-events:none}.content-restriction__sidebar__overlay{background-color:rgba(0,0,0,.5);height:100%;left:0;opacity:0;position:fixed;top:0;transition:opacity .5s;width:100%}.content-restriction__sidebar__content{background:#fff;border-radius:var(--content-restriction-border-radius);box-shadow:0 20px 30px 0 rgba(0,0,0,.1);display:flex;flex-direction:column;gap:15px;height:100vh;max-width:500px;opacity:0;padding:15px 0;position:absolute;right:0;top:70px;transform:translateX(50px);transition:opacity .3s,transform .5s;width:100%;z-index:1}.content-restriction__sidebar__content__header{display:flex;gap:20px;padding:0 20px}.content-restriction__sidebar__content__title{align-items:center;color:#000;display:flex;flex:1;font-size:24px;font-weight:700;line-height:30px;margin:0}.content-restriction__sidebar__content__btn{align-items:center;background-color:transparent;border:1.5px solid rgba(0,0,0,.05);border-radius:var(--content-restriction-border-radius);color:#1d2327;display:flex;font-size:14px;gap:10px;height:40px;justify-content:center;padding:8px 20px;transition:all .3s ease}.content-restriction__sidebar__content__btn:hover{background-color:rgba(0,0,0,.5);color:#fff}.content-restriction__sidebar__content__close-btn{align-items:center;border-radius:50%;color:#000;cursor:pointer;display:flex;font-size:20px;height:30px;justify-content:center;width:30px}.content-restriction__sidebar__content__body{color:#000;font-size:16px;font-weight:400}.content-restriction__sidebar--visible{pointer-events:auto}.content-restriction__sidebar--visible .content-restriction__sidebar__content,.content-restriction__sidebar--visible .content-restriction__sidebar__overlay{opacity:1}.content-restriction__sidebar--visible .content-restriction__sidebar__content{opacity:1;transform:translateX(0)}.content-restriction__sidebar__tab{display:flex;flex-direction:column}.content-restriction__sidebar__tab__header{background:transparent!important;border:none;border-bottom:2px solid #e8e7e4;margin:0;padding:0 20px}.content-restriction__sidebar__tab__content{border-top:1.5px solid #000;padding:20px}.content-restriction__sidebar__tab__content__event{margin:20px 0 0}.content-restriction__sidebar__tab__content__event__desc{font-size:16px;line-height:2}.content-restriction__sidebar__tab__content__event__title{color:#000;font-size:20px;font-weight:400;line-height:26px;margin:0}.content-restriction__sidebar__tab__content__event__wrapper{display:flex;flex-direction:column;flex-wrap:wrap;gap:10px;margin:20px 0 0;position:relative}.content-restriction__sidebar__tab__content__event__section-wrapper{display:flex;flex-direction:column;gap:10px}.content-restriction__sidebar__tab__content__event__btn{align-items:center;background-color:transparent;border:2px solid #95928e;border-radius:var(--content-restriction-border-radius);box-shadow:0 5px 10px 0 rgba(0,0,0,.1);color:#000;cursor:pointer;display:flex;font-size:16px;gap:60px;justify-content:space-between;padding:8px 20px;position:relative;transition:all .3s ease;width:100%}.content-restriction__sidebar__tab__content__event__btn:hover{border-color:var(--content-restriction-primary-color)}.content-restriction__sidebar__tab__content__event__dropdown{background-color:#fff;border:1px solid #95928e;opacity:0;position:absolute;right:0;top:100%;transform:translateY(-10px);transition:all .3s ease;visibility:hidden;width:100%;z-index:1}.content-restriction__sidebar__tab__content__event__dropdown.active{opacity:1;transform:translateY(0);visibility:visible}.content-restriction__sidebar__tab__content__event__dropdown.active .content-restriction__sidebar__tab__content__event__dropdown__btn{pointer-events:auto}.content-restriction__sidebar__tab__content__event__dropdown__item{margin:0}.content-restriction__sidebar__tab__content__event__dropdown__btn{background-color:transparent;color:#000;padding:8px 25px;pointer-events:none;text-align:left;transition:all .3s ease;width:100%}.content-restriction__sidebar__tab__content__event__dropdown__btn:hover{box-shadow:0 5px 10px 0 rgba(0,0,0,.1)}.content-restriction__sidebar__tab .react-tabs__tab{background:transparent;border:none;border-bottom:2px solid transparent;box-sizing:border-box;color:#444;margin:0;width:100%}.content-restriction__sidebar__tab .react-tabs__tab:after{display:none}.content-restriction__sidebar__tab .react-tabs__tab.react-tabs__tab--selected{border-color:#000;color:#000;font-weight:700}
     2.content-restriction__rules{min-height:calc(70vh - 80px);padding:30px 20px}.content-restriction__rules__header{align-items:center;display:flex;justify-content:space-between;padding:50px 25px 25px}.content-restriction__rules__header__title{font-size:32px;font-weight:700}.content-restriction__rules__list{background-color:#fff!important;border-radius:var(--content-restriction-border-radius);border-spacing:unset;padding:40px;width:100%}.content-restriction__rules__list__header th{border-bottom:2px solid #ccc;color:#000;font-size:14px;font-weight:700;padding:16px 5px!important;text-align:start}.content-restriction__rules__list__header th:first-child{padding-inline-start:0}.content-restriction__rules__body td{border-bottom:1px solid #ccc;box-sizing:border-box;color:#000;font-size:14px;font-weight:400;height:55px;padding:16px 5px!important}.content-restriction__rules__body td:last-child{justify-content:flex-end;padding-inline-end:0}.content-restriction__rules__body td:first-child{padding-inline-start:0}.content-restriction__rules__body a{align-items:center;color:#000;display:flex;font-size:14px;font-weight:500;gap:10px;text-decoration:none}.content-restriction__rules__body a:hover{color:var(--content-restriction-primary-color)}.content-restriction__rules__icon{display:flex;gap:5px}.content-restriction__rules__action{display:flex;gap:20px}.content-restriction__rules__action a{border:none;box-shadow:none}.content-restriction__rules__action .delete-btn svg path,.content-restriction__rules__action a svg path{fill:var(--content-restriction-primary-color)}.content-restriction__create-rules{align-items:center;display:flex;flex-direction:column;gap:70px;justify-content:center;min-height:calc(90vh - 80px)}.content-restriction__single{position:relative}.content-restriction__single__btn{align-items:center;background-color:#fff;border-radius:var(--content-restriction-border-radius);box-sizing:border-box;color:#000;cursor:pointer;display:flex;font-size:16px;font-weight:700;gap:10px;padding:12px 20px;position:relative;transition:all .3s ease;width:385px}.content-restriction__single__btn img{border-radius:var(--content-restriction-border-radius);box-shadow:0 0 3px #ddd;flex:1;max-width:25px;padding:6px 8px}.content-restriction__single__btn__title{flex:1;font-size:16px;margin:0}.content-restriction__single__btn__action{height:100%;text-align:end}.content-restriction__single__btn:hover{box-shadow:0 5px 10px 0 rgba(0,0,0,.1)}.content-restriction__single__btn.disabled{opacity:.5;pointer-events:none}.content-restriction__single__btn__dropdown{box-shadow:0 0 15px rgba(0,0,0,.082);inset-inline-start:100%;margin:0;opacity:0;position:absolute;top:0;transform:translateY(-10px);transition:all .3s ease;visibility:hidden;width:125px;z-index:1}.content-restriction__single__btn__dropdown.active{opacity:1;transform:translateY(0);visibility:visible}.content-restriction__single__btn__dropdown__item{cursor:auto;margin:0}.content-restriction__single__btn__dropdown__btn{background-color:#fff;color:#000;font-size:14px;padding:8px 25px;transition:all .3s ease;width:100%}.content-restriction__single__btn__dropdown__btn:hover{box-shadow:0 5px 10px 0 rgba(0,0,0,.1)}.content-restriction__single__btn__dropdown__btn.disabled{color:#95928e;pointer-events:none}.content-restriction__single__btn__dropdown__btn--delete{border-radius:var(--content-restriction-border-radius);color:#f5f5f5;padding:12px 25px}.content-restriction__single__btn__dropdown__btn--delete,.content-restriction__single__btn__dropdown__btn--delete:hover{background-color:var(--content-restriction-primary-color)}.content-restriction__single:before{align-items:center;border-radius:100%;content:"Then Unlock";display:flex;font-size:15px;height:20px;justify-content:center;left:50%;position:absolute;top:calc(100% + 28px);transform:translateX(calc(-50% + 1px));width:200px;z-index:1}.content-restriction__single:nth-child(2):before{content:"Otherwise, Restrict Using"}.content-restriction__single:after{border-right:2px dashed #d7d5d2;content:"";height:70px;left:50%;position:absolute;top:100%;transform:translateX(-50%);width:2px}.content-restriction__single:last-child:after,.content-restriction__single:last-child:before{display:none}.content-restriction__modal{pointer-events:none}.content-restriction__modal__overlay{background-color:rgba(0,0,0,.5);height:100%;left:0;opacity:0;position:fixed;top:0;transition:opacity .5s;width:100%;z-index:2}.content-restriction__modal__content{border-radius:var(--content-restriction-border-radius);display:flex;flex-direction:column;left:50%;max-height:550px;max-width:1000px;opacity:0;position:absolute;top:50%;transform:translate(-50%,-50%) scale(.9);transition:opacity .3s,transform .5s;width:100%;z-index:2}.content-restriction__modal__content__title{margin:10px 0}.content-restriction__modal__content__desc{margin-bottom:0}.content-restriction__modal__content__header{background:#1f3121;box-sizing:border-box;display:flex;gap:20px;justify-content:space-between;left:0;padding:20px;position:absolute;top:0;width:100%;z-index:1}.content-restriction__modal__content__header__info{align-items:center;display:flex;gap:10px}.content-restriction__modal__content__header__info .info-icon{background:#fff;border-radius:var(--content-restriction-border-radius);padding:10px}.content-restriction__modal__content__header__action{align-items:center;display:flex;gap:10px}.content-restriction__modal__content__header__action__btn{align-items:center;background-color:transparent;border:1px solid #fff;border-radius:var(--content-restriction-border-radius);color:#fff;display:flex;font-size:14px;font-weight:500;gap:10px;justify-content:center;padding:10px 25px;text-decoration:none;transition:all .3s ease;white-space:nowrap}.content-restriction__modal__content__header__action__btn:hover{background-color:#fff;border-color:#fff;color:#000}.content-restriction__modal__content__title{color:#fff;font-size:24px;font-weight:700}.content-restriction__modal__content__desc{color:#fff;font-size:14px;font-weight:400}.content-restriction__modal__content__btn{align-items:center;background-color:#fff;border-radius:var(--content-restriction-border-radius);color:#000;cursor:pointer;display:flex;justify-content:center;padding:10px 25px}.content-restriction__modal__content__close-btn{align-items:center;border-radius:50%;color:#fff;cursor:pointer;display:flex;font-size:20px;height:30px;justify-content:center;width:30px}.content-restriction__modal__content__body{background:#fff;color:#000;font-size:16px;font-weight:400}.content-restriction__modal__content__wrapper{align-items:flex-start;display:flex}.content-restriction__modal--visible{pointer-events:auto}.content-restriction__modal--visible .content-restriction__modal__content,.content-restriction__modal--visible .content-restriction__modal__overlay{opacity:1}.content-restriction__modal--visible .content-restriction__modal__content{opacity:1;transform:translate(-50%,-50%) scale(1)}.content-restriction__module{display:flex;flex:1;flex-wrap:wrap;gap:15px;padding:0 15px}.content-restriction__group{display:flex;flex-direction:column;gap:6px;height:100%;left:15px;margin:0;position:absolute;top:123px;width:200px}.content-restriction__group~.content-restriction__type{padding-left:215px}.content-restriction__group~.content-restriction__type .content-restriction__type__item{flex:0 0 32.8%;max-width:33%}@media screen and (max-width:768px){.content-restriction__group{flex-direction:row;justify-content:center;width:100%}}.content-restriction__group__item{margin:0}.content-restriction__group__btn{background-color:#e6e6e6;border-radius:6px;padding:10px 15px;transition:all .3s ease;width:100%}.content-restriction__group__btn.active,.content-restriction__group__btn:hover{background-color:#1f3121;color:#fff}.content-restriction__type{align-items:center;box-sizing:border-box;display:flex;flex:1;flex-wrap:wrap;gap:5px;margin:0;max-height:550px;min-height:360px;overflow-y:auto;padding:123px 0 15px;scrollbar-width:thin}.content-restriction__type__item{flex:0 0 32.84%;margin:0;max-width:32.84%}.content-restriction__type .pro-item .pro-badge,.content-restriction__type .pro-item .upcoming-badge{font-size:12px;padding:3px 8px;position:absolute;right:15px;text-align:right}.content-restriction__type .pro-item .upcoming-badge{background:#93003f;background:#ecfdf5;border-radius:100px;color:#fff;color:#047857}.content-restriction__type .pro-item{position:relative}.content-restriction__type__btn{align-content:baseline;align-items:center;border:1px solid #e6e6e6;border-radius:var(--content-restriction-border-radius);color:#000;display:flex;flex-direction:column;flex-wrap:wrap;flex-flow:column;font-size:15px;font-weight:600;min-height:205px;padding:15px;transition:all .3s ease;white-space:nowrap;width:100%}.content-restriction__type__btn h3{font-size:1.1em}.content-restriction__type__btn img{border-radius:var(--content-restriction-border-radius);margin-right:5px;max-width:40px;padding:2px}.content-restriction__type__btn span{font-weight:400;line-height:1.6;text-align:center;white-space:normal}.content-restriction__type__btn:hover{border-color:#d1cdcd;box-shadow:0 10px 15px 5px rgba(0,0,0,.1)}.content-restriction__sidebar{pointer-events:none}.content-restriction__sidebar__overlay{background-color:rgba(0,0,0,.5);height:100%;left:0;opacity:0;position:fixed;top:0;transition:opacity .5s;width:100%}.content-restriction__sidebar__content{background:#fff;border-radius:var(--content-restriction-border-radius);box-shadow:0 20px 30px 0 rgba(0,0,0,.1);display:flex;flex-direction:column;gap:15px;height:calc(90vh - 80px);max-width:500px;opacity:0;overflow-y:auto;padding:15px 0;position:absolute;right:0;top:70px;transform:translateX(50px);transition:opacity .3s,transform .5s;width:100%;z-index:1}.content-restriction__sidebar__content__header{display:flex;gap:20px;padding:0 20px}.content-restriction__sidebar__content__title{align-items:center;color:#000;display:flex;flex:1;font-size:24px;font-weight:700;line-height:30px;margin:0}.content-restriction__sidebar__content__btn{align-items:center;background-color:transparent;border:1.5px solid rgba(0,0,0,.05);border-radius:var(--content-restriction-border-radius);color:#1d2327;display:flex;font-size:14px;gap:10px;height:40px;justify-content:center;padding:8px 20px;transition:all .3s ease}.content-restriction__sidebar__content__btn:hover{background-color:rgba(0,0,0,.5);color:#fff}.content-restriction__sidebar__content__close-btn{align-items:center;border-radius:50%;color:#000;cursor:pointer;display:flex;font-size:20px;height:30px;justify-content:center;width:30px}.content-restriction__sidebar__content__body{color:#000;font-size:16px;font-weight:400}.content-restriction__sidebar--visible{pointer-events:auto}.content-restriction__sidebar--visible .content-restriction__sidebar__content,.content-restriction__sidebar--visible .content-restriction__sidebar__overlay{opacity:1}.content-restriction__sidebar--visible .content-restriction__sidebar__content{opacity:1;transform:translateX(0)}.content-restriction__sidebar__tab{display:flex;flex-direction:column}.content-restriction__sidebar__tab__header{background:transparent!important;border:none;border-bottom:2px solid #e8e7e4;margin:0;padding:0 20px}.content-restriction__sidebar__tab__content{border-top:1.5px solid #000;padding:20px}.content-restriction__sidebar__tab__content__event{margin:20px 0 0}.content-restriction__sidebar__tab__content__event__desc{font-size:16px;line-height:2}.content-restriction__sidebar__tab__content__event__title{color:#000;font-size:20px;font-weight:400;line-height:26px;margin:0}.content-restriction__sidebar__tab__content__event__wrapper{display:flex;flex-direction:column;flex-wrap:wrap;gap:10px;margin:20px 0 0;position:relative}.content-restriction__sidebar__tab__content__event__section-wrapper{display:flex;flex-direction:column;gap:10px}.content-restriction__sidebar__tab__content__event__btn{align-items:center;background-color:transparent;border:2px solid #95928e;border-radius:var(--content-restriction-border-radius);box-shadow:0 5px 10px 0 rgba(0,0,0,.1);color:#000;cursor:pointer;display:flex;font-size:16px;gap:60px;justify-content:space-between;padding:8px 20px;position:relative;transition:all .3s ease;width:100%}.content-restriction__sidebar__tab__content__event__btn:hover{border-color:var(--content-restriction-primary-color)}.content-restriction__sidebar__tab__content__event__dropdown{background-color:#fff;border:1px solid #95928e;opacity:0;position:absolute;right:0;top:100%;transform:translateY(-10px);transition:all .3s ease;visibility:hidden;width:100%;z-index:1}.content-restriction__sidebar__tab__content__event__dropdown.active{opacity:1;transform:translateY(0);visibility:visible}.content-restriction__sidebar__tab__content__event__dropdown.active .content-restriction__sidebar__tab__content__event__dropdown__btn{pointer-events:auto}.content-restriction__sidebar__tab__content__event__dropdown__item{margin:0}.content-restriction__sidebar__tab__content__event__dropdown__btn{background-color:transparent;color:#000;padding:8px 25px;pointer-events:none;text-align:left;transition:all .3s ease;width:100%}.content-restriction__sidebar__tab__content__event__dropdown__btn:hover{box-shadow:0 5px 10px 0 rgba(0,0,0,.1)}.content-restriction__sidebar__tab .react-tabs__tab{background:transparent;border:none;border-bottom:2px solid transparent;box-sizing:border-box;color:#444;margin:0;width:100%}.content-restriction__sidebar__tab .react-tabs__tab:after{display:none}.content-restriction__sidebar__tab .react-tabs__tab.react-tabs__tab--selected{border-color:#000;color:#000;font-weight:700}
    33.content-restriction__integrations{clear:both;padding-block-start:10px}.content-restriction__integrations__header{margin:30px auto 60px;max-width:770px;padding-top:40px;text-align:center}.content-restriction__integrations__header__title{font-size:32px}.content-restriction__integrations__header p{font-size:18px}.content-restriction__integrations__list{display:grid;grid-gap:20px;grid-template-columns:repeat(auto-fit,minmax(360px,1fr));padding:0 60px 60px}.content-restriction__integrations__list__item{align-items:flex-start;background-color:#fff;border:1px solid #e6e8ea;border-radius:var(--content-restriction-border-radius);display:flex;flex-direction:column;padding:20px 24px;transition:all .3s}.content-restriction__integrations__list__item__header{align-items:flex-start;display:flex;justify-content:space-between;width:100%}.content-restriction__integrations__list__item__header img{border-radius:var(--content-restriction-border-radius);display:flex;margin-block-end:20px;width:70px}.content-restriction__integrations__list__item__header .badge{background:#ecfdf5;border-radius:100px;color:#047857;padding:3px 8px}.content-restriction__integrations__list__item__title{font-size:20px;line-height:1.6;margin:0}.content-restriction__integrations__list__item__desc{flex-grow:1}.content-restriction__integrations__list__item__actions{align-items:center;display:flex;justify-content:space-between;margin-block-start:20px;width:100%}.content-restriction__integrations__list__item__actions .learn-more{text-decoration:none}.content-restriction__integrations__list__item__actions .action{background-color:var(--content-restriction-primary-color);border:none;border-radius:var(--content-restriction-border-radius);color:#fff;cursor:pointer;font-size:12px;font-weight:500;line-height:1.2;outline:none;padding:8px 16px;text-decoration:none;transition:var(--content-restriction-transition-hover)}
    44.content-restriction__settings{clear:both;margin:0 auto;padding-block-start:10px}.content-restriction__settings__header{margin:30px auto 15px;padding-top:40px;text-align:center}.content-restriction__settings .settings-save-button{margin-top:30px}.content-restriction__settings .site-layout-background{background:transparent}
  • content-restriction/tags/1.4.0/assets/704.js

    r3180815 r3294741  
    1 "use strict";(self.webpackChunkcontent_restriction=self.webpackChunkcontent_restriction||[]).push([[704],{6704:(e,t,n)=>{n.r(t),n.d(t,{default:()=>le});var c=n(1609),r=n(4976),a=n(7767),i=n(6207),l=n(261),s=n(7143),o=n(6087);const _={modalVisible:!1,sidebarVisible:!1,ruleType:"",contentRule:{status:!1,id:"",ruleTitle:"",whoCanSee:{},whatContent:{},restrictView:{},ruleData:{}}},m=(0,s.createReduxStore)("content-restriction-stores",{reducer(e=(()=>_)(),t){let n;switch(t.type){case"SET_WHO_CAN_SEE":n={...e,contentRule:{...e.contentRule,whoCanSee:{...t.whoCanSee}}};break;case"SET_WHAT_CONTENT":n={...e,contentRule:{...e.contentRule,whatContent:{...t.whatContent}}};break;case"SET_RESTRICT_VIEW":n={...e,contentRule:{...e.contentRule,restrictView:{...t.restrictView}}};break;case"SET_RULE":n={...e,contentRule:{...e.contentRule,ruleData:t.rule}};break;case"SET_RULE_STATUS":n={...e,contentRule:{...e.contentRule,status:t.status}};break;case"SET_ID":n={...e,contentRule:{...e.contentRule,id:t.id}};break;case"SET_RULE_TITLE":n={...e,contentRule:{...e.contentRule,ruleTitle:t.ruleTitle}};break;case"SET_RULE_TYPE":n={...e,ruleType:t.ruleType};break;case"SET_MODAL_VISIBLE":n={...e,modalVisible:t.modalVisible};break;case"SET_SIDEBAR_VISIBLE":n={...e,sidebarVisible:t.sidebarVisible};break;default:n=e}return localStorage.setItem("content-restriction-stores",JSON.stringify(n)),n},actions:{setWhoCanSee:e=>({type:"SET_WHO_CAN_SEE",whoCanSee:e}),setWhatContent:e=>({type:"SET_WHAT_CONTENT",whatContent:e}),setRestrictView:e=>({type:"SET_RESTRICT_VIEW",restrictView:e}),setRule:e=>({type:"SET_RULE",rule:e}),setRulePublished:e=>({type:"SET_RULE_STATUS",status:e}),setId:e=>({type:"SET_ID",id:e}),setRuleTitle:e=>({type:"SET_RULE_TITLE",ruleTitle:e}),setRuleType:e=>({type:"SET_RULE_TYPE",ruleType:e}),setModalVisible:e=>({type:"SET_MODAL_VISIBLE",modalVisible:e}),setSidebarVisible:e=>({type:"SET_SIDEBAR_VISIBLE",sidebarVisible:e})},selectors:{getRuleData:e=>e.contentRule.ruleData,getRuleStatus:e=>e.contentRule.status,getId:e=>e.contentRule.id,getRuleTitle:e=>e.contentRule.ruleTitle,getWhoCanSee:e=>e.contentRule.whoCanSee,getWhatContent:e=>e.contentRule.whatContent,getRestrictView:e=>e.contentRule.restrictView,getRule:e=>e.contentRule,getRuleType:e=>e.ruleType,getModal:e=>e.modalVisible,getSidebar:e=>e.sidebarVisible}});(0,s.register)(m);const u=m;var d=n(1848),E=n(7723),h=n(1455),p=n.n(h);async function g(e,t,n){n=n||{},t=t||{};const c=[["X-WP-Nonce",content_restriction_admin.rest_args.nonce]];return await p()({path:e,method:"POST",data:t,headers:c,...n}).then((e=>e)).catch((e=>{throw e}))}const{confirm:M}=d.A;var N=n(2359);function b(e,t){N.Ay[e]({message:t,placement:"bottomLeft"})}function w({}){const[e,t]=(0,o.useState)({}),[n,_]=(0,o.useState)(""),[m,d]=(0,o.useState)("Untitled Rule"),[h,p]=(0,o.useState)(!1),[M,N]=(0,o.useState)(!1),[w,y]=(0,o.useState)(!1),v=(0,a.Zp)(),I=(0,s.select)("content-restriction-stores"),S=(0,o.useRef)(null),C=e=>{S.current&&!S.current.contains(e.target)&&y(!1)};(0,o.useEffect)((()=>(document.addEventListener("mousedown",C),()=>{document.removeEventListener("mousedown",C)})),[]),(0,o.useEffect)((()=>{const e=(0,s.subscribe)((()=>{const e=I.getId(),n=I.getRuleData(),c=I.getRuleTitle(),r=I.getRuleStatus();_(e),d(c||m),t(n),N(r)}));return()=>e()}));const T=(0,o.useRef)(null);(0,o.useEffect)((()=>{const e=e=>{if(h){const t=T.current?.contains(e.target),n=e.target.classList.contains("anticon-edit");t||n||p(!1)}};return document.addEventListener("click",e),()=>{document.removeEventListener("click",e)}}),[h]);const j=n?()=>function(e,t,n,c){t&&t.hasOwnProperty("who-can-see")&&t.hasOwnProperty("what-content")&&t.hasOwnProperty("restrict-view")?g("content-restriction/rules/update",{id:e,data:{status:c,title:n,rule:t}}).then((e=>{b("success",(0,E.__)("Successfully Updated!","content-restriction"))})).catch((e=>{b("error",(0,E.__)("Rules update error","content-restriction"))})):b("warning",(0,E.__)("Please complete the setup","content-restriction"))}(n,e,m,M):()=>function(e,t,n,c){e&&e.hasOwnProperty("who-can-see")&&e.hasOwnProperty("what-content")&&e.hasOwnProperty("restrict-view")?g("content-restriction/rules/create",{data:{status:n,title:t,rule:e}}).then((e=>{b("success",(0,E.__)("Successfully Created!","content-restriction")),c(`/rule/${e}`)})).catch((e=>{b("error",(0,E.__)("Rules create error","content-restriction"))})):b("warning",(0,E.__)("Please complete the setup","content-restriction"))}(e,m,M,v);return(0,c.createElement)(c.Fragment,null,(0,c.createElement)("div",{className:"content-restriction__header"},(0,c.createElement)("div",{className:"content-restriction__header__action content-restriction__header__action--left"},(0,c.createElement)(r.N_,{to:"/",class:"content-restriction__btn content-restriction__btn--sm content-restriction__btn--back"},(0,c.createElement)(i.A,null),(0,E.__)("Back","content-restriction")),(0,c.createElement)("div",{className:"content-restriction__header__action__input"},h?(0,c.createElement)("input",{type:"text",ref:T,value:m,onChange:e=>(0,s.dispatch)(u).setRuleTitle(e.target.value)}):(0,c.createElement)("h2",{className:"content-restriction__header__title"},m),(0,c.createElement)("p",{className:"content-restriction__header__action__edit"},h?(0,c.createElement)(i.A,{onClick:e=>{e.stopPropagation(),p(!1)}}):(0,c.createElement)(l.A,{onClick:e=>{e.stopPropagation(),p(!0)}})))),(0,c.createElement)("div",{className:"content-restriction__header__action content-restriction__header__action--right"},(0,c.createElement)("button",{className:"content-restriction__btn content-restriction__btn--create",onClick:j},n?(0,E.__)("Update","content-restriction"):(0,E.__)("Publish","content-restriction")))))}var y=n(2318),v=n(1005),I=n(3009);function S(e){const{id:t,type:n,openKey:r,setOpenKey:a,changeAction:i,resetType:l}=e,s=(0,o.useRef)(null);(0,o.useEffect)((()=>{const e=e=>{!s.current||s.current.contains(e.target)||e.target.closest(".ant-dropdown-trigger")||setTimeout((()=>{a(null)}),100)};return document.addEventListener("mousedown",e),()=>{document.removeEventListener("mousedown",e)}}),[a]);const _=[{key:"remove",label:(0,c.createElement)("a",{onClick:e=>{e.stopPropagation(),l(e,n)}},(0,E.__)("Remove","content-restriction"))},{key:"change",label:(0,c.createElement)("a",{onClick:e=>{e.stopPropagation(),i(e,n)}},(0,E.__)("Change","content-restriction"))}],m=r===n;return(0,c.createElement)("div",{ref:s},(0,c.createElement)(I.A,{menu:{items:_},trigger:["click"],placement:"bottomRight",open:!t&&m,onOpenChange:()=>{a(n)}},(0,c.createElement)("button",{className:"content-restriction__single__btn__action",onClick:e=>{e.stopPropagation(),t?i(e,n):a(n)}},t?(0,c.createElement)(v.A,null):(0,c.createElement)(y.A,null))))}const C="data:image/svg+xml;base64,PHN2ZyBmaWxsPSJub25lIiBoZWlnaHQ9IjQ4IiB2aWV3Qm94PSIwIDAgNDAgNDgiIHdpZHRoPSI0MCIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48cGF0aCBjbGlwLXJ1bGU9ImV2ZW5vZGQiIGQ9Im0yMCA0NGMxMS4wNDU3IDAgMjAtOC45NTQzIDIwLTIwcy04Ljk1NDMtMjAtMjAtMjBjLTExLjA0NTcyIDAtMjAgOC45NTQzLTIwIDIwczguOTU0MjggMjAgMjAgMjB6bTYuMjM5My0zMC42ODMyYy4zMDM3LTEuMDc4Ny0uNzQzMi0xLjcxNjctMS42OTkzLTEuMDM1NWwtMTMuMzQ2OSA5LjUwODNjLTEuMDM2OS43Mzg3LS44NzM4IDIuMjEwNC4yNDUgMi4yMTA0aDMuNTE0NnYtLjAyNzJoNi44NDk4bC01LjU4MTMgMS45NjkzLTIuNDYwNSA4Ljc0MTFjLS4zMDM3IDEuMDc4OC43NDMxIDEuNzE2NyAxLjY5OTMgMS4wMzU1bDEzLjM0NjktOS41MDgyYzEuMDM2OS0uNzM4Ny44NzM3LTIuMjEwNS0uMjQ1LTIuMjEwNWgtNS4zMjk4eiIgZmlsbD0iIzE1NWVlZiIgZmlsbC1ydWxlPSJldmVub2RkIi8+PC9zdmc+";var T=n(7072);const j=()=>(0,c.createElement)(c.Fragment,null,(0,c.createElement)("li",{className:"content-restriction__type__item"},(0,c.createElement)("button",{className:"content-restriction__type__btn"},(0,c.createElement)(T.A,{active:!0,paragraph:{rows:4}}))),(0,c.createElement)("li",{className:"content-restriction__type__item"},(0,c.createElement)("button",{className:"content-restriction__type__btn"},(0,c.createElement)(T.A,{active:!0,paragraph:{rows:4}}))),(0,c.createElement)("li",{className:"content-restriction__type__item"},(0,c.createElement)("button",{className:"content-restriction__type__btn"},(0,c.createElement)(T.A,{active:!0,paragraph:{rows:4}}))),(0,c.createElement)("li",{className:"content-restriction__type__item"},(0,c.createElement)("button",{className:"content-restriction__type__btn"},(0,c.createElement)(T.A,{active:!0,paragraph:{rows:4}}))),(0,c.createElement)("li",{className:"content-restriction__type__item"},(0,c.createElement)("button",{className:"content-restriction__type__btn"},(0,c.createElement)(T.A,{active:!0,paragraph:{rows:4}}))),(0,c.createElement)("li",{className:"content-restriction__type__item"},(0,c.createElement)("button",{className:"content-restriction__type__btn"},(0,c.createElement)(T.A,{active:!0,paragraph:{rows:4}})))),D=()=>{const e=(0,s.select)("content-restriction-stores"),[t,n]=(0,o.useState)(e.getRuleType()||"who-can-see"),[r,a]=(0,o.useState)([]),[i,l]=(0,o.useState)(!1),[_,m]=(0,o.useState)(e.getModal()||!1),[d,h]=(0,o.useState)("-"),[p,M]=(0,o.useState)("-"),N=(0,s.subscribe)((()=>{const t=e.getModal(),c=e.getRuleType();m(t),n(c),"restrict-view"===c&&(h((0,E.__)("How should the content be protected?","content-restriction")),M((0,E.__)("When user does not have access permission, the following options help control their experience.","content-restriction"))),"what-content"===c&&(h((0,E.__)("What content will be unlocked?","content-restriction")),M((0,E.__)("When user have access permission, the following content will be available.","content-restriction"))),"who-can-see"===c&&(h((0,E.__)("Who can see the content?","content-restriction")),M((0,E.__)("Which user type should be allowed to see the content.","content-restriction")))}));(0,o.useEffect)((()=>(m(e.getModal()),()=>N())));const b=()=>{m(e.getModal());const n=e.getWhatContent(),c=e.getWhoCanSee(),r=e.getRestrictView();t&&g(`content-restriction/modules/${t}`,{what_content:n?.key,who_can_see:c?.key,restrict_view:r?.key}).then((e=>{a(e),l(!0)}))};(0,o.useEffect)((()=>{b(),l(!1)}),[t]),(0,o.useEffect)((()=>{b()}),[]);const w=()=>{(0,s.dispatch)(u).setModalVisible(!1)};return(0,c.createElement)("div",{className:"content-restriction__modal "+(_?"content-restriction__modal--visible":"")},(0,c.createElement)("div",{className:"content-restriction__modal__overlay",onClick:w}),(0,c.createElement)("div",{className:"content-restriction__modal__content"},(0,c.createElement)("div",{className:"content-restriction__modal__content__header"},(0,c.createElement)("div",{className:"content-restriction__modal__content__header__info"},(0,c.createElement)("div",{class:"info-text"},(0,c.createElement)("h2",{class:"content-restriction__modal__content__title"},d),(0,c.createElement)("p",{class:"content-restriction__modal__content__desc"},p))),(0,c.createElement)("div",{className:"content-restriction__modal__content__header__action"},(0,c.createElement)("button",{className:"content-restriction__modal__content__close-btn",onClick:w},"x"))),(0,c.createElement)("div",{className:"content-restriction__modal__content__body"},(0,c.createElement)("div",{className:"content-restriction__modal__content__wrapper"},(0,c.createElement)("div",{className:"content-restriction__module"},r.length>0?(0,c.createElement)(c.Fragment,null,(0,c.createElement)("ul",{className:"content-restriction__type"},i?r?.map(((n,r)=>(0,c.createElement)(c.Fragment,null,n.upcoming||n.is_pro&&!content_restriction_admin.pro_available?(0,c.createElement)("li",{className:"content-restriction__type__item pro-item",key:r},(0,c.createElement)("button",{className:"content-restriction__type__btn",title:n.is_pro?(0,E.__)("Upgrade Now","content-restriction"):(0,E.__)("Upcoming","content-restriction")},n.upcoming?(0,c.createElement)("span",{class:"upcoming-badge"},(0,E.__)("Upcoming","content-restriction")):"",n.is_pro?(0,c.createElement)("span",{class:"pro-badge"},(0,c.createElement)("svg",{width:"20",height:"20",viewBox:"0 0 12 12",fill:"none",xmlns:"http://www.w3.org/2000/svg"},(0,c.createElement)("g",{"clip-path":"url(#clip0_457_540)"},(0,c.createElement)("path",{d:"M12 3.06766C12 2.40317 11.4594 1.86264 10.795 1.86264C10.1305 1.86264 9.58997 2.40317 9.58997 3.06766C9.58997 3.61594 9.61278 4.33792 9.16941 4.66046L8.70365 4.9993C8.219 5.35188 7.53519 5.20188 7.24262 4.67881L7.01772 4.27675C6.7391 3.77861 7.00523 3.12326 7.14059 2.56878C7.16295 2.47719 7.1748 2.38153 7.1748 2.28314C7.1748 1.61865 6.63428 1.07812 5.96979 1.07812C5.3053 1.07812 4.76477 1.61865 4.76477 2.28314C4.76477 2.39417 4.77986 2.50174 4.80809 2.6039C4.95811 3.1467 5.23419 3.78222 4.97543 4.2824L4.80172 4.61819C4.51816 5.16632 3.81066 5.32929 3.31588 4.96046L2.82316 4.59317C2.37951 4.26245 2.41013 3.53404 2.41013 2.98068C2.41013 2.31619 1.8696 1.77567 1.20511 1.77567C0.540527 1.77567 0 2.31619 0 2.98068C0 3.33173 0.150933 3.64809 0.391293 3.86846C0.666239 4.12054 0.977007 4.37886 1.06625 4.74104L2.29778 9.73924C2.40786 10.186 2.80861 10.5 3.26874 10.5H8.80645C9.26982 10.5 9.6725 10.1817 9.77945 9.73081L10.9414 4.83229C11.028 4.46732 11.3394 4.20557 11.6143 3.95037C11.8514 3.73024 12 3.41603 12 3.06766Z",fill:"#F17D0E"})),(0,c.createElement)("defs",null,(0,c.createElement)("clipPath",{id:"clip0_457_540"},(0,c.createElement)("rect",{width:"12",height:"12",fill:"white"}))))):"",(0,c.createElement)("img",{src:n?.icon||C,alt:n.name}),(0,c.createElement)("h3",null,n.name),(0,c.createElement)("span",null,n.desc))):(0,c.createElement)("li",{className:"content-restriction__type__item",key:r},(0,c.createElement)("button",{className:"content-restriction__type__btn",onClick:()=>((t,n)=>{(0,s.dispatch)(u).setModalVisible(!1),(0,s.dispatch)(u).setSidebarVisible(!0),(0,s.dispatch)(u).setRuleType(t);const c={...e.getRuleData(),[t]:n.key};(0,s.dispatch)(u).setRule(c),"who-can-see"===t?(0,s.dispatch)(u).setWhoCanSee(n):"what-content"===t?(0,s.dispatch)(u).setWhatContent(n):"restrict-view"===t&&(0,s.dispatch)(u).setRestrictView(n)})(t,n)},(0,c.createElement)("img",{src:n?.icon||C,alt:n.name}),(0,c.createElement)("h3",null,n.name),(0,c.createElement)("span",null,n.desc)))))):(0,c.createElement)(j,null))):"")))))};var f=n(3303),z=n(6190),A=n(1575);function k(e){return"string"!=typeof e?"":e.replace(/[^a-zA-Z0-9]/g," ").split(/[\s_]+/).map((e=>e.charAt(0).toUpperCase()+e.slice(1))).join(" ")}function R(e){return Object.entries(e||{}).map((([e,t])=>({value:e,label:"string"==typeof t?t:t.title})))}const{TextArea:L}=f.A,x=()=>{const[e,t]=(0,o.useState)(!1),[n,r]=(0,o.useState)("Action"),[a,i]=(0,o.useState)(),[l,_]=(0,o.useState)(!1),[m,d]=(0,o.useState)(!1),[h,p]=(0,o.useState)(null),[g,M]=(0,o.useState)([]),[N,b]=(0,o.useState)(null),[w,y]=(0,o.useState)({}),[v,I]=(0,o.useState)("");(0,o.useEffect)((()=>{const e=(0,s.select)("content-restriction-stores");_(e.getSidebar());const n=(0,s.subscribe)((()=>{const n=e.getSidebar(),c=e.getRuleType(),a=e.getRuleData(),l=e.getWhoCanSee(),s=e.getWhatContent(),o=e.getRestrictView();_(n),t(c),y(a),"who-can-see"===c?(i(l),r(l.name)):"what-content"===c?(i(s),r(s.name)):"restrict-view"===c&&(i(o),r(o.name))}));return()=>n()}));const S=(t,n)=>{y((c=>({...c,[e]:{[a.key]:{...c[e]?.[a.key],[t]:n}}})))};return(0,o.useEffect)((()=>{const e=w&&w["what-content"];if(e&&"object"==typeof e)for(const[t,n]of Object.entries(e))I(t);else I(e);(0,s.dispatch)(u).setRule(w)}),[w]),(0,o.useEffect)((()=>{if(p(null),M(null),b(null),a&&!a?.options)y((t=>({...t,[e]:a?.key})));else if(a&&e&&w&&w[e]?.[a.key]){const t=w[e][a.key];if("string"==typeof t||"number"==typeof t)p(t),M([]),b([]);else if("object"==typeof t){const e=Object.keys(t)[0];if(p(e),Array.isArray(t[e])){b(t[e]);const n=a.options[e];if(n&&"multi-select"===n.type){const e=Object.entries(n.options||{}).map((([e,t])=>({value:e,label:t})));M(e)}}else M([]),b([])}}else y((t=>({...t,[e]:a?.key})))}),[a]),(0,c.createElement)("div",{className:"content-restriction__sidebar "+(l?"content-restriction__sidebar--visible":"")},a?(0,c.createElement)("div",{className:"content-restriction__sidebar__content"},(0,c.createElement)("div",{className:"content-restriction__sidebar__content__header"},(0,c.createElement)("h2",{className:"content-restriction__sidebar__content__title"},n),(0,c.createElement)("button",{className:"content-restriction__sidebar__content__btn",onClick:e=>(e=>{e.stopPropagation(),(0,s.dispatch)(u).setSidebarVisible(!1),(0,s.dispatch)(u).setModalVisible(!0)})(e)},(0,E.__)("Change","content-restriction")),(0,c.createElement)("button",{className:"content-restriction__sidebar__content__close-btn",onClick:()=>{(0,s.dispatch)(u).setSidebarVisible(!1)}},"x")),(0,c.createElement)("div",{className:"content-restriction__sidebar__content__body"},(0,c.createElement)("div",{className:"content-restriction__sidebar__tab"},(0,c.createElement)("div",{className:"tab-content content-restriction__sidebar__tab__content",id:"nav-tabContent"},(0,c.createElement)("div",{className:"content-restriction__sidebar__tab__content__event"},(0,c.createElement)("div",{className:"content-restriction__sidebar__tab__content__event__wrapper"},"select"===a?.type?(0,c.createElement)(c.Fragment,null,(0,c.createElement)("h3",{className:"content-restriction__sidebar__tab__content__event__title"},(0,E.__)("Select ","content-restriction")," ",a?.name,"   ",(0,E.__)("(required) ","content-restriction")),(0,c.createElement)(z.A,{allowClear:!0,style:{width:"100%",marginBottom:"10px"},placeholder:(0,E.__)("Please select an option","content-restriction"),onChange:t=>{const n=a.options[t];if(p(t),b([]),n&&"object"==typeof n&&"multi-select"===n.type){const c=Object.entries(n.options||{}).map((([e,t])=>({value:e,label:t})));M(c),y((n=>({...n,[e]:{[a.key]:{[t]:[]}}})))}else n?(M([]),y((n=>({...n,[e]:{[a.key]:t}})))):M([])},options:R(a?.options),value:h}),h&&g.length>0&&(0,c.createElement)(c.Fragment,null,(0,c.createElement)("h3",{className:"content-restriction__sidebar__tab__content__event__title"}," ",(0,E.__)("Choose","content-restriction")," ",k(h)),(0,c.createElement)(z.A,{mode:"multiple",allowClear:!0,style:{width:"100%"},placeholder:`Select ${h} option`,onChange:t=>{b(t),y((n=>({...n,[e]:{[a.key]:{[h]:t}}})))},options:g,value:N}))):"section"===a?.type?(0,c.createElement)(c.Fragment,null,a.options&&Object.entries(a.options).length>0?Object.entries(a.options).map((([t,n])=>"text"===n.type||"url"===n.type?(0,c.createElement)("div",{className:"content-restriction__sidebar__tab__content__event__section-wrapper",key:t},(0,c.createElement)("h3",{className:"content-restriction__sidebar__tab__content__event__title"},n.title),(0,c.createElement)(f.A,{id:`content-restriction__${t}`,placeholder:`Type ${n.title}`,value:w&&w[e]?.[a.key]?.[t]||"",onChange:e=>S(t,e.target.value)})):"textarea"===n.type?(0,c.createElement)("div",{className:"content-restriction__sidebar__tab__content__event__section-wrapper",key:t},(0,c.createElement)("h3",{className:"content-restriction__sidebar__tab__content__event__title"},n.title),(0,c.createElement)(L,{id:`content-restriction__${t}`,rows:4,placeholder:`Type ${n.title}`,value:w&&w[e]?.[a.key]?.[t]||"",onChange:e=>S(t,e.target.value)})):"range"===n.type?(0,c.createElement)("div",{className:"content-restriction__sidebar__tab__content__event__section-wrapper",key:t},(0,c.createElement)("h3",{className:"content-restriction__sidebar__tab__content__event__title"},n.title),(0,c.createElement)(A.A,{defaultValue:n.default,value:w&&w[e]?.[a.key]?.[t]||n.default,onChange:e=>S(t,e)})):"multi-select"===n.type?(0,c.createElement)("div",{className:"content-restriction__sidebar__tab__content__event__section-wrapper",key:t},(0,c.createElement)("h3",{className:"content-restriction__sidebar__tab__content__event__title"},n.title),(0,c.createElement)(z.A,{mode:"multiple",allowClear:!0,style:{width:"100%"},placeholder:(0,E.__)("Please select","content-restriction"),onChange:e=>S(t,e),options:R(n.options),value:w&&w[e]?.[a.key]?.[t]||[]})):null)):(0,c.createElement)("div",null,(0,E.__)("No options available","content-restriction"))):(0,c.createElement)(c.Fragment,null,(0,c.createElement)("p",{className:"content-restriction__sidebar__tab__content__event__desc"},a?.desc)))))))):null)},O=()=>(0,c.createElement)(c.Fragment,null,(0,c.createElement)("div",{className:"content-restriction__single__btn"},(0,c.createElement)(T.A,{active:!0,title:!1,paragraph:{rows:1,width:"100%"}})));function V(){const[e,t]=(0,o.useState)(null),[n,r]=(0,o.useState)([]),[a,i]=(0,o.useState)(""),[l,_]=(0,o.useState)(""),[m,d]=(0,o.useState)(""),[h,p]=(0,o.useState)(null),[M,N]=(0,o.useState)(!1),[b,w]=(0,o.useState)(C),[y,v]=(0,o.useState)(C),[I,T]=(0,o.useState)(C),j={name:"",key:"",type:"",options:""};(0,o.useEffect)((()=>{const e=window.location.href.split("/"),n=e[e.length-1];if("rule"===n)return N(!0),(0,s.dispatch)(u).setWhoCanSee(j),(0,s.dispatch)(u).setWhatContent(j),(0,s.dispatch)(u).setRestrictView(j),(0,s.dispatch)(u).setRuleTitle(""),(0,s.dispatch)(u).setRulePublished(""),(0,s.dispatch)(u).setId(""),void(0,s.dispatch)(u).setRule("");t(e[6]),g("content-restriction/rules/list").then((e=>{r(e);const t=e.length>0&&e.find((e=>e.id===n));(0,s.dispatch)(u).setId(t?.id),(0,s.dispatch)(u).setRule(t?.rule),(0,s.dispatch)(u).setRulePublished(t?.status),(0,s.dispatch)(u).setRuleTitle(t?.title);const c=t&&t?.rule["who-can-see"]?"object"==typeof t?.rule["who-can-see"]?Object.keys(t?.rule["who-can-see"])[0]:"string"==typeof t?.rule["who-can-see"]?t?.rule["who-can-see"]:"":"",a=t&&t?.rule["what-content"]?"object"==typeof t?.rule["what-content"]?Object.keys(t?.rule["what-content"])[0]:"string"==typeof t?.rule["what-content"]?t?.rule["what-content"]:"":"",l=t&&t?.rule["restrict-view"]?"object"==typeof t?.rule["restrict-view"]?Object.keys(t?.rule["restrict-view"])[0]:"string"==typeof t?.rule["restrict-view"]?t?.rule["restrict-view"]:"":"";i(k(c)),_(k(a)),d(k(l));const o=async(e,t)=>{try{const n=(e&&await g(`content-restriction/modules/${e}`)).find((e=>e.key===t));n&&("who-can-see"===e?(0,s.dispatch)(u).setWhoCanSee(n):"what-content"===e?(0,s.dispatch)(u).setWhatContent(n):"restrict-view"===e&&(0,s.dispatch)(u).setRestrictView(n))}catch(e){}};o("who-can-see",c),o("what-content",a),o("restrict-view",l),N(!0)})).catch((e=>{}))}),[]),(0,o.useEffect)((()=>{const e=(0,s.select)("content-restriction-stores"),t=(0,s.subscribe)((()=>{var t,n,c;const r=e.getWhoCanSee(),a=e.getWhatContent(),l=e.getRestrictView();i(r.name),_(a.name),d(l.name),w(null!==(t=r.icon)&&void 0!==t?t:b),v(null!==(n=a.icon)&&void 0!==n?n:y),T(null!==(c=l.icon)&&void 0!==c?c:I)}));return()=>t()}),[n]);const f=(e,t)=>{e.stopPropagation(),(0,s.dispatch)(u).setRuleType(t),"who-can-see"===t?a?A():z():"what-content"===t?l?A():z():"restrict-view"===t&&(m?A():z())},z=()=>{p(null),(0,s.dispatch)(u).setModalVisible(!0)},A=()=>{p(null),(0,s.dispatch)(u).setSidebarVisible(!0)},R=(e,t)=>{e.stopPropagation(),(0,s.dispatch)(u).setModalVisible(!1),(0,s.dispatch)(u).setSidebarVisible(!1),"who-can-see"===t?(i(""),(0,s.dispatch)(u).setWhoCanSee(j)):"what-content"===t?(_(""),(0,s.dispatch)(u).setWhatContent(j)):"restrict-view"===t&&(d(""),(0,s.dispatch)(u).setRestrictView(j))},L=(e,t)=>{e.stopPropagation(),p(null),(0,s.dispatch)(u).setRuleType(t),(0,s.dispatch)(u).setModalVisible(!0)};return(0,c.createElement)(c.Fragment,null,(0,c.createElement)("section",{className:"content-restriction__create-rules"},M?(0,c.createElement)(c.Fragment,null,(0,c.createElement)("div",{className:"content-restriction__single"},(0,c.createElement)("div",{className:"content-restriction__single__btn",onClick:e=>f(e,"who-can-see")},(0,c.createElement)("img",{src:b}),a?(0,c.createElement)(c.Fragment,null,(0,c.createElement)("h3",{className:"content-restriction__single__btn__title"},a),(0,c.createElement)(S,{id:e,type:"who-can-see",openKey:h,setOpenKey:p,changeAction:L,resetType:R})):(0,c.createElement)("h3",{className:"content-restriction__single__btn__title"},(0,E.__)("Who can see the content?","content-restriction")))),(0,c.createElement)("div",{className:"content-restriction__single"},(0,c.createElement)("div",{className:"content-restriction__single__btn "+(a?"":"disabled"),onClick:e=>f(e,"what-content")},(0,c.createElement)("img",{src:y}),l?(0,c.createElement)(c.Fragment,null,(0,c.createElement)("h3",{className:"content-restriction__single__btn__title"},l),(0,c.createElement)(S,{id:e,type:"what-content",openKey:h,setOpenKey:p,changeAction:L,resetType:R})):(0,c.createElement)("h3",{className:"content-restriction__single__btn__title"},(0,E.__)("What content will be unlocked?","content-restriction")))),(0,c.createElement)("div",{className:"content-restriction__single"},(0,c.createElement)("div",{className:"content-restriction__single__btn "+(a&&l?"":"disabled"),onClick:e=>f(e,"restrict-view")},(0,c.createElement)("img",{src:I}),m?(0,c.createElement)(c.Fragment,null,(0,c.createElement)("h3",{className:"content-restriction__single__btn__title"},m),(0,c.createElement)(S,{id:e,type:"restrict-view",openKey:h,setOpenKey:p,changeAction:L,resetType:R})):(0,c.createElement)("h3",{className:"content-restriction__single__btn__title"},(0,E.__)("How should the content be protected?","content-restriction"))))):(0,c.createElement)(c.Fragment,null,(0,c.createElement)(O,null),(0,c.createElement)(O,null),(0,c.createElement)(O,null))),(0,c.createElement)(D,null),(0,c.createElement)(x,null))}function W(){return(0,c.createElement)(c.Fragment,null,(0,c.createElement)(w,null),(0,c.createElement)(V,null))}var U=n(9266);const P=[{key:"rules",label:(0,c.createElement)(r.N_,{to:"/rules",className:"content-restriction__menu__single"},(0,E.__)("Rules","content-restriction"))},{key:"integrations",label:(0,c.createElement)(r.N_,{to:"/integrations",className:"content-restriction__menu__single"},(0,E.__)("Integrations","content-restriction"))},{key:"license",label:content_restriction_admin.pro_available?"":(0,c.createElement)("a",{href:"https://contentrestriction.com/pricing/?utm_source=wp-plugins&utm_campaign=upgrade-to-pro&utm_medium=wp-dash",target:"_blank",className:"upgrade-to-pro"},(0,c.createElement)("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",xmlns:"http://www.w3.org/2000/svg"},(0,c.createElement)("g",{"clip-path":"url(#clip0_457_540)"},(0,c.createElement)("path",{d:"M12 3.06766C12 2.40317 11.4594 1.86264 10.795 1.86264C10.1305 1.86264 9.58997 2.40317 9.58997 3.06766C9.58997 3.61594 9.61278 4.33792 9.16941 4.66046L8.70365 4.9993C8.219 5.35188 7.53519 5.20188 7.24262 4.67881L7.01772 4.27675C6.7391 3.77861 7.00523 3.12326 7.14059 2.56878C7.16295 2.47719 7.1748 2.38153 7.1748 2.28314C7.1748 1.61865 6.63428 1.07812 5.96979 1.07812C5.3053 1.07812 4.76477 1.61865 4.76477 2.28314C4.76477 2.39417 4.77986 2.50174 4.80809 2.6039C4.95811 3.1467 5.23419 3.78222 4.97543 4.2824L4.80172 4.61819C4.51816 5.16632 3.81066 5.32929 3.31588 4.96046L2.82316 4.59317C2.37951 4.26245 2.41013 3.53404 2.41013 2.98068C2.41013 2.31619 1.8696 1.77567 1.20511 1.77567C0.540527 1.77567 0 2.31619 0 2.98068C0 3.33173 0.150933 3.64809 0.391293 3.86846C0.666239 4.12054 0.977007 4.37886 1.06625 4.74104L2.29778 9.73924C2.40786 10.186 2.80861 10.5 3.26874 10.5H8.80645C9.26982 10.5 9.6725 10.1817 9.77945 9.73081L10.9414 4.83229C11.028 4.46732 11.3394 4.20557 11.6143 3.95037C11.8514 3.73024 12 3.41603 12 3.06766Z",fill:"#F17D0E"})),(0,c.createElement)("defs",null,(0,c.createElement)("clipPath",{id:"clip0_457_540"},(0,c.createElement)("rect",{width:"12",height:"12",fill:"white"})))),(0,E.__)("Upgrade Now","content-restriction"))}];function H({menuKey:e}){return(0,c.createElement)(U.A,{selectedKeys:[e],mode:"horizontal",items:P,lineWidth:"0",style:{width:"100%",lineHeight:"70px"}})}function Q({menuKey:e}){return(0,c.createElement)(c.Fragment,null,(0,c.createElement)("div",{className:"content-restriction__header"},(0,c.createElement)("div",{className:"content-restriction__header__action content-restriction__header__action--left"},(0,c.createElement)(r.N_,{to:"/",className:"content-restriction__menu__single"},(0,c.createElement)("img",{src:"data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSI0MyIgaGVpZ2h0PSI0MyIgdmlld0JveD0iMCAwIDQzIDQzIiBmaWxsPSJub25lIj4KPHBhdGggZD0iTTAgM0MwIDEuMzQzMTQgMS4zNDMxNSAwIDMgMEg0MEM0MS42NTY5IDAgNDMgMS4zNDMxNSA0MyAzVjQwQzQzIDQxLjY1NjkgNDEuNjU2OSA0MyA0MCA0M0gzQzEuMzQzMTQgNDMgMCA0MS42NTY5IDAgNDBWM1oiIGZpbGw9IiMzNzQ3RDYiLz4KPHBhdGggZD0iTTEyLjM5MDkgMTMuNjYzSDEzLjU0MTkiIHN0cm9rZT0id2hpdGUiIHN0cm9rZS13aWR0aD0iMS41IiBzdHJva2UtbGluZWNhcD0icm91bmQiIHN0cm9rZS1saW5lam9pbj0icm91bmQiLz4KPHBhdGggZD0iTTE2LjY1NDggMTMuNjYzSDI3LjE5NTMiIHN0cm9rZT0id2hpdGUiIHN0cm9rZS13aWR0aD0iMS41IiBzdHJva2UtbGluZWNhcD0icm91bmQiIHN0cm9rZS1saW5lam9pbj0icm91bmQiLz4KPHBhdGggZD0iTTE2LjM2NjkgMjkuNDI5NUMxNi4zNjY5IDI4LjM5OTUgMTYuMzY2OSAyNy45MTE2IDE2LjcxMjMgMjcuNTg2NEMxNy4wNTc2IDI3LjI2MTEgMTcuNTc1NiAyNy4yNjExIDE4LjY2OTEgMjcuMjYxMUgyMy4yNzM0QzI0LjM2NjkgMjcuMjYxMSAyNC44ODQ5IDI3LjI2MTEgMjUuMjMwMyAyNy41ODY0QzI1LjU3NTYgMjcuOTExNiAyNS41NzU2IDI4LjM5OTUgMjUuNTc1NiAyOS40Mjk1VjMwLjUxMzdDMjUuNTc1NiAzMi4wMzE1IDI1LjU3NTYgMzIuNzkwNSAyNS4wNTc2IDMzLjI3ODNDMjQuNTM5NiAzMy43NjYyIDIzLjczMzggMzMuNzY2MiAyMi4xMjIzIDMzLjc2NjJIMTkuODIwMkMxOC4yMDg3IDMzLjc2NjIgMTcuNDAyOSAzMy43NjYyIDE2Ljg4NDkgMzMuMjc4M0MxNi4zNjY5IDMyLjc5MDUgMTYuMzY2OSAzMi4wMzE1IDE2LjM2NjkgMzAuNTEzN1YyOS40Mjk1WiIgc3Ryb2tlPSIjRkZFNUQ2IiBzdHJva2Utd2lkdGg9IjEuNSIgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIi8+CjxwYXRoIGQ9Ik0yMy4yNzMzIDI2LjcxOTFWMjYuMTc3QzIzLjI3MzMgMjQuOTg0NCAyMi4yMzczIDI0LjAwODcgMjAuOTcxMSAyNC4wMDg3QzE5LjcwNDkgMjQuMDA4NyAxOC42Njg5IDI0Ljk4NDQgMTguNjY4OSAyNi4xNzdWMjYuNzE5MSIgc3Ryb2tlPSIjRkZFNUQ2IiBzdHJva2Utd2lkdGg9IjEuNSIgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIi8+CjxwYXRoIGQ9Ik0xMi42ODM1IDMyLjU1MTFDMTAuNjExNSAzMi4zMzQzIDkgMzAuNzA4IDkgMjguNzAyMlYxMy45MDMxQzkgMTEuNzM0NyAxMC44NDE3IDEwIDEzLjE0MzkgMTBIMjguODU2MUMzMS4xNTgzIDEwIDMzIDExLjczNDcgMzMgMTMuOTAzMVYyOC43MDIyQzMzIDMwLjcwOCAzMS4zODg1IDMyLjMzNDMgMjkuMzE2NSAzMi41NTExIiBzdHJva2U9IndoaXRlIiBzdHJva2Utd2lkdGg9IjIiIHN0cm9rZS1taXRlcmxpbWl0PSIxMCIgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIi8+CjxwYXRoIGQ9Ik05LjIzNDEzIDE2Ljc3NTZIMzIuNzA5MSIgc3Ryb2tlPSJ3aGl0ZSIgc3Ryb2tlLXdpZHRoPSIxLjUiIHN0cm9rZS1taXRlcmxpbWl0PSIxMCIgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIi8+Cjwvc3ZnPg==",alt:"{__( 'Content Restriction', 'content-restriction' )}"})),(0,c.createElement)("div",{className:"content-restriction__menu__single__name"},(0,c.createElement)("span",null,"All-in-One"),(0,c.createElement)("span",{className:"content-restriction__menu__single__name__highlight"},(0,E.__)("Content Restriction","content-restriction")))),(0,c.createElement)("div",{className:"content-restriction__header__action content-restriction__header__action--right"},(0,c.createElement)(H,{menuKey:e}))))}var Y=n(2609),Z=n(6795);function B({timestamp:e}){return F(1e3*e)}const F=e=>{const t=new Date,n=new Date(e),c=Math.floor((t-n)/1e3);let r=Math.floor(c/31536e3);return r>=1?1===r?(0,E.__)(" 1 year ago","content-restriction"):r+(0,E.__)(" years ago","content-restriction"):(r=Math.floor(c/2592e3),r>=1?1===r?(0,E.__)(" 1 month ago","content-restriction"):r+(0,E.__)(" months ago","content-restriction"):(r=Math.floor(c/86400),r>=1?1===r?(0,E.__)(" 1 day ago","content-restriction"):r+(0,E.__)(" days ago","content-restriction"):(r=Math.floor(c/3600),r>=1?1===r?(0,E.__)(" 1 hour ago","content-restriction"):r+(0,E.__)(" hours ago","content-restriction"):(r=Math.floor(c/60),r>=1?1===r?(0,E.__)(" 1 minute ago","content-restriction"):r+(0,E.__)(" minutes ago","content-restriction"):1===Math.floor(c)?(0,E.__)(" 1 second ago","content-restriction"):Math.floor(c)+(0,E.__)(" seconds ago","content-restriction")))))},G=()=>(0,c.createElement)(c.Fragment,null,(0,c.createElement)("tr",null,(0,c.createElement)("td",null,(0,c.createElement)(T.A,{active:!0,title:!1,paragraph:{rows:1,width:"100%"}})),(0,c.createElement)("td",null,(0,c.createElement)(T.A,{active:!0,title:!1,paragraph:{rows:1,width:"100%"}})),(0,c.createElement)("td",null,(0,c.createElement)(T.A,{active:!0,title:!1,paragraph:{rows:1,width:"100%"}})),(0,c.createElement)("td",null,(0,c.createElement)(T.A,{active:!0,title:!1,paragraph:{rows:1,width:"100%"}}))));function J(){const e=(0,a.Zp)(),[t,n]=(0,o.useState)([]),[i,l]=(0,o.useState)({}),[s,_]=(0,o.useState)(!1);return(0,o.useEffect)((()=>{const e=t.reduce(((e,t)=>(e[t.id]=t.status,e)),{});l(e)}),[t]),(0,o.useEffect)((()=>{g("content-restriction/rules/list").then((e=>{n(e),_(!0)})).catch((e=>{b("error",(0,E.__)("Something wen't wrong!","content-restriction"))}))}),[]),(0,c.createElement)("div",{class:"content-restriction__rules relative"},(0,c.createElement)("table",{class:"content-restriction__rules__list"},(0,c.createElement)("thead",{class:"content-restriction__rules__list__header"},(0,c.createElement)("tr",null,(0,c.createElement)("th",{scope:"col",width:"5%"},(0,E.__)("Status","content-restriction")),(0,c.createElement)("th",{scope:"col"},(0,E.__)("Name","content-restriction")),(0,c.createElement)("th",{scope:"col"},(0,E.__)("Last edit","content-restriction")),(0,c.createElement)("th",{scope:"col",width:"5%",className:"text-center"},(0,E.__)("Actions","content-restriction")))),(0,c.createElement)("tbody",{class:"content-restriction__rules__body"},t.length>0?t.map(((t,n)=>(0,c.createElement)("tr",{key:n},(0,c.createElement)("td",null,(0,c.createElement)(Y.A,{checked:i[t.id],onChange:e=>((e,t,n,c)=>{l({...i,[t]:e}),g("content-restriction/rules/update",{id:t,data:{status:e,title:n,rule:c}}).then((e=>{b("success",(0,E.__)("Successfully updated!","content-restriction"))})).catch((e=>{b("error",(0,E.__)("Status update error","content-restriction"))}))})(e,t.id,t.title,t.rule),checkedChildren:"",unCheckedChildren:""})),(0,c.createElement)("td",null,(0,c.createElement)(r.N_,{to:`/rule/${t.id}`},t.title)),(0,c.createElement)("td",null,(0,c.createElement)(B,{timestamp:t.modified})),(0,c.createElement)("td",{className:"content-restriction__rules__action"},(0,c.createElement)(Z.A,{title:(0,E.__)("Delete","content-restriction")},(0,c.createElement)("a",{href:"#",className:"delete-btn"},(0,c.createElement)("svg",{onClick:()=>{return n=t.id,c=e,void M({title:(0,E.__)("Are you sure you want to delete this item?","content-restriction"),content:(0,E.__)("This action cannot be undone.","content-restriction"),okText:(0,E.__)("Confirm","content-restriction"),okType:"danger",cancelText:(0,E.__)("Cancel","content-restriction"),onOk(){((e,t)=>{g(`content-restriction/rules/delete?id=${e}`).then((e=>{t("/rules"),window.location.reload()})).catch((e=>{}))})(n,c)},onCancel(){}});var n,c},width:"13",height:"18",viewBox:"0 0 304 384",xmlns:"http://www.w3.org/2000/svg"},(0,c.createElement)("path",{fill:"#CA0B00",d:"M21 341V85h256v256q0 18-12.5 30.5T235 384H64q-18 0-30.5-12.5T21 341M299 21v43H0V21h75L96 0h107l21 21z"})))),(0,c.createElement)(Z.A,{title:"Edit"},(0,c.createElement)(r.N_,{to:`/rule/${t.id}`},(0,c.createElement)("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",height:"24",width:"24",size:"24",name:"actionEdit"},(0,c.createElement)("path",{fill:"#2D2E2E",d:"m16.92 5 3.51 3.52 1.42-1.42-4.93-4.93L3 16.09V21h4.91L19.02 9.9 17.6 8.48 7.09 19H5v-2.09L16.92 5Z"})))))))):s?(0,c.createElement)("tr",null,(0,c.createElement)("td",{colSpan:"4",className:"text-center"},(0,E.__)("No rules was found! Create new rule","content-restriction"))):(0,c.createElement)(c.Fragment,null,(0,c.createElement)(G,null),(0,c.createElement)(G,null),(0,c.createElement)(G,null)))))}function K(){return(0,c.createElement)(c.Fragment,null,(0,c.createElement)(Q,{menuKey:"rules"}),(0,c.createElement)("div",{className:"content-restriction__rules container"},(0,c.createElement)("div",{className:"content-restriction__rules__header"},(0,c.createElement)("h1",{className:"content-restriction__rules__header__title"},"Rules"),(0,c.createElement)(r.N_,{to:"/rule",className:"content-restriction__btn content-restriction__btn--create"},(0,c.createElement)("svg",{width:"15",height:"15",viewBox:"0 0 29 29",fill:"none",xmlns:"http://www.w3.org/2000/svg"},(0,c.createElement)("path",{d:"M15.2031 0.4375C15.5761 0.4375 15.9338 0.585658 16.1975 0.849381C16.4612 1.1131 16.6094 1.47079 16.6094 1.84375V12.3906H27.1562C27.5292 12.3906 27.8869 12.5388 28.1506 12.8025C28.4143 13.0662 28.5625 13.4239 28.5625 13.7969V15.2031C28.5625 15.5761 28.4143 15.9338 28.1506 16.1975C27.8869 16.4612 27.5292 16.6094 27.1562 16.6094H16.6094V27.1562C16.6094 27.5292 16.4612 27.8869 16.1975 28.1506C15.9338 28.4143 15.5761 28.5625 15.2031 28.5625H13.7969C13.4239 28.5625 13.0662 28.4143 12.8025 28.1506C12.5388 27.8869 12.3906 27.5292 12.3906 27.1562V16.6094H1.84375C1.47079 16.6094 1.1131 16.4612 0.849381 16.1975C0.585658 15.9338 0.4375 15.5761 0.4375 15.2031V13.7969C0.4375 13.4239 0.585658 13.0662 0.849381 12.8025C1.1131 12.5388 1.47079 12.3906 1.84375 12.3906H12.3906V1.84375C12.3906 1.47079 12.5388 1.1131 12.8025 0.849381C13.0662 0.585658 13.4239 0.4375 13.7969 0.4375H15.2031Z",fill:"white"})),(0,c.createElement)("span",null,(0,E.__)("Create Rule","content-restriction")))),(0,c.createElement)(J,null)))}const X=()=>(0,c.createElement)("div",{class:"content-restriction__integrations__list__item"},(0,c.createElement)("div",{class:"content-restriction__integrations__list__item__header"},(0,c.createElement)(T.A,{active:!0,title:!1,paragraph:{rows:8,width:"100%"}})));function $(){const[e,t]=(0,o.useState)([]),[n,r]=(0,o.useState)(!1);return(0,o.useEffect)((()=>{g("content-restriction/settings/integrations").then((e=>{t(e),r(!0)})).catch((e=>{b("error",(0,E.__)("Something wen't wrong!","content-restriction"))}))}),[]),(0,c.createElement)("div",{class:"content-restriction__integrations__list"},n?e.map(((e,t)=>(0,c.createElement)("div",{class:"content-restriction__integrations__list__item"},(0,c.createElement)("div",{class:"content-restriction__integrations__list__item__header"},(0,c.createElement)("img",{src:e.icon,alt:e.title}),(0,c.createElement)("div",{class:"badges"},e.badges.map(((e,t)=>(0,c.createElement)("span",{class:"badge"},k(e)))))),(0,c.createElement)("h3",{class:"content-restriction__integrations__list__item__title"},e.title),(0,c.createElement)("div",{class:"content-restriction__integrations__list__item__desc"},(0,c.createElement)("p",null,e.details)),(0,c.createElement)("p",{class:"content-restriction__integrations__list__item__actions"},e.link?(0,c.createElement)("a",{target:"__blank",href:e.link+"?utm_source=plugin&utm_medium=link&utm_campaign=integrations",class:"learn-more"},(0,E.__)("Learn more","content-restriction")):(0,c.createElement)("span",null),e.action&&"upgrade"===e.action?(0,c.createElement)("a",{href:"https://contentrestriction.com/pricing/?utm_source=wp-plugins&utm_campaign=upgrade-to-pro&utm_medium=wp-dash",class:"action upgrade-to-pro",target:"__blank"},(0,E.__)("Let's go","content-restriction")):"")))):(0,c.createElement)(c.Fragment,null,(0,c.createElement)(X,null),(0,c.createElement)(X,null),(0,c.createElement)(X,null),(0,c.createElement)(X,null),(0,c.createElement)(X,null),(0,c.createElement)(X,null),(0,c.createElement)(X,null),(0,c.createElement)(X,null),(0,c.createElement)(X,null),(0,c.createElement)(X,null)))}function q(){return(0,c.createElement)(c.Fragment,null,(0,c.createElement)(Q,{menuKey:"integrations"}),(0,c.createElement)("div",{className:"content-restriction__integrations container"},(0,c.createElement)("div",{className:"content-restriction__integrations__header"},(0,c.createElement)("h1",{className:"content-restriction__integrations__header__title"},(0,E.__)("Integrations","content-restriction")),(0,c.createElement)("p",null,(0,E.__)("Seamlessly integrate with other plugins to enhance your website’s content visibility and control functionality. Use advanced conditional rules to create a more personalized user experience.","content-restriction"))),(0,c.createElement)($,null)))}function ee(){return(0,c.createElement)(c.Fragment,null,(0,c.createElement)(w,null),(0,c.createElement)(V,null))}var te=n(5448);const{TextArea:ne}=f.A,{Option:ce}=z.A,{Sider:re,Content:ae}=te.A,{TextArea:ie}=f.A,le=function(){return(0,c.createElement)(c.Fragment,null,(0,c.createElement)(r.I9,null,(0,c.createElement)(a.BV,null,(0,c.createElement)(a.qh,{path:"/",element:(0,c.createElement)(K,null)}),(0,c.createElement)(a.qh,{path:"/rules",element:(0,c.createElement)(K,null)}),(0,c.createElement)(a.qh,{path:"/rule",element:(0,c.createElement)(W,null)}),(0,c.createElement)(a.qh,{path:"/rule/:id",element:(0,c.createElement)(ee,null)}),(0,c.createElement)(a.qh,{path:"/integrations",element:(0,c.createElement)(q,null)}))))}}}]);
     1"use strict";(globalThis.webpackChunkcontent_restriction=globalThis.webpackChunkcontent_restriction||[]).push([[704],{6704:(e,t,n)=>{n.r(t),n.d(t,{default:()=>se});var c=n(1609),r=n(4976),a=n(7767),i=n(6207),s=n(261),l=n(7143),o=n(6087);const _={modalVisible:!1,sidebarVisible:!1,ruleType:"",contentRule:{status:!1,id:"",ruleTitle:"",whoCanSee:{},whatContent:{},restrictView:{},ruleData:{}}},m=(0,l.createReduxStore)("content-restriction-stores",{reducer(e=(()=>_)(),t){let n;switch(t.type){case"SET_WHO_CAN_SEE":n={...e,contentRule:{...e.contentRule,whoCanSee:{...t.whoCanSee}}};break;case"SET_WHAT_CONTENT":n={...e,contentRule:{...e.contentRule,whatContent:{...t.whatContent}}};break;case"SET_RESTRICT_VIEW":n={...e,contentRule:{...e.contentRule,restrictView:{...t.restrictView}}};break;case"SET_RULE":n={...e,contentRule:{...e.contentRule,ruleData:t.rule}};break;case"SET_RULE_STATUS":n={...e,contentRule:{...e.contentRule,status:t.status}};break;case"SET_ID":n={...e,contentRule:{...e.contentRule,id:t.id}};break;case"SET_RULE_TITLE":n={...e,contentRule:{...e.contentRule,ruleTitle:t.ruleTitle}};break;case"SET_RULE_TYPE":n={...e,ruleType:t.ruleType};break;case"SET_MODAL_VISIBLE":n={...e,modalVisible:t.modalVisible};break;case"SET_SIDEBAR_VISIBLE":n={...e,sidebarVisible:t.sidebarVisible};break;default:n=e}return localStorage.setItem("content-restriction-stores",JSON.stringify(n)),n},actions:{setWhoCanSee:e=>({type:"SET_WHO_CAN_SEE",whoCanSee:e}),setWhatContent:e=>({type:"SET_WHAT_CONTENT",whatContent:e}),setRestrictView:e=>({type:"SET_RESTRICT_VIEW",restrictView:e}),setRule:e=>({type:"SET_RULE",rule:e}),setRulePublished:e=>({type:"SET_RULE_STATUS",status:e}),setId:e=>({type:"SET_ID",id:e}),setRuleTitle:e=>({type:"SET_RULE_TITLE",ruleTitle:e}),setRuleType:e=>({type:"SET_RULE_TYPE",ruleType:e}),setModalVisible:e=>({type:"SET_MODAL_VISIBLE",modalVisible:e}),setSidebarVisible:e=>({type:"SET_SIDEBAR_VISIBLE",sidebarVisible:e})},selectors:{getRuleData:e=>e.contentRule.ruleData,getRuleStatus:e=>e.contentRule.status,getId:e=>e.contentRule.id,getRuleTitle:e=>e.contentRule.ruleTitle,getWhoCanSee:e=>e.contentRule.whoCanSee,getWhatContent:e=>e.contentRule.whatContent,getRestrictView:e=>e.contentRule.restrictView,getRule:e=>e.contentRule,getRuleType:e=>e.ruleType,getModal:e=>e.modalVisible,getSidebar:e=>e.sidebarVisible}});(0,l.register)(m);const u=m;var d=n(4697),E=n(7723),h=n(1455),p=n.n(h);async function g(e,t,n){n=n||{},t=t||{};const c=[["X-WP-Nonce",content_restriction_admin.rest_args.nonce]];return await p()({path:e,method:"POST",data:t,headers:c,...n}).then((e=>e)).catch((e=>{throw e}))}const{confirm:M}=d.A;var N=n(2359);function b(e,t){N.Ay[e]({message:t,placement:"bottomLeft"})}function w({}){const[e,t]=(0,o.useState)({}),[n,_]=(0,o.useState)(""),[m,d]=(0,o.useState)("Untitled Rule"),[h,p]=(0,o.useState)(!1),[M,N]=(0,o.useState)(!1),[w,y]=(0,o.useState)(!1),v=(0,a.Zp)(),S=(0,l.select)("content-restriction-stores"),I=(0,o.useRef)(null),C=e=>{I.current&&!I.current.contains(e.target)&&y(!1)};(0,o.useEffect)((()=>(document.addEventListener("mousedown",C),()=>{document.removeEventListener("mousedown",C)})),[]),(0,o.useEffect)((()=>{const e=(0,l.subscribe)((()=>{const e=S.getId(),n=S.getRuleData(),c=S.getRuleTitle(),r=S.getRuleStatus();_(e),d(c||m),t(n),N(r)}));return()=>e()}));const T=(0,o.useRef)(null);(0,o.useEffect)((()=>{const e=e=>{if(h){const t=T.current?.contains(e.target),n=e.target.classList.contains("anticon-edit");t||n||p(!1)}};return document.addEventListener("click",e),()=>{document.removeEventListener("click",e)}}),[h]);const j=n?()=>function(e,t,n,c){t&&t.hasOwnProperty("who-can-see")&&t.hasOwnProperty("what-content")&&t.hasOwnProperty("restrict-view")?g("content-restriction/rules/update",{id:e,data:{status:c,title:n,rule:t}}).then((e=>{b("success",(0,E.__)("Successfully Updated!","content-restriction"))})).catch((e=>{b("error",(0,E.__)("Rules update error","content-restriction"))})):b("warning",(0,E.__)("Please complete the setup","content-restriction"))}(n,e,m,M):()=>function(e,t,n,c){e&&e.hasOwnProperty("who-can-see")&&e.hasOwnProperty("what-content")&&e.hasOwnProperty("restrict-view")?g("content-restriction/rules/create",{data:{status:n,title:t,rule:e}}).then((e=>{b("success",(0,E.__)("Successfully Created!","content-restriction")),c(`/rule/${e}`)})).catch((e=>{b("error",(0,E.__)("Rules create error","content-restriction"))})):b("warning",(0,E.__)("Please complete the setup","content-restriction"))}(e,m,M,v);return(0,c.createElement)(c.Fragment,null,(0,c.createElement)("div",{className:"content-restriction__header"},(0,c.createElement)("div",{className:"content-restriction__header__action content-restriction__header__action--left"},(0,c.createElement)(r.N_,{to:"/",class:"content-restriction__btn content-restriction__btn--sm content-restriction__btn--back"},(0,c.createElement)(i.A,null),(0,E.__)("Back","content-restriction")),(0,c.createElement)("div",{className:"content-restriction__header__action__input"},h?(0,c.createElement)("input",{type:"text",ref:T,value:m,onChange:e=>(0,l.dispatch)(u).setRuleTitle(e.target.value)}):(0,c.createElement)("h2",{className:"content-restriction__header__title"},m),(0,c.createElement)("p",{className:"content-restriction__header__action__edit"},h?(0,c.createElement)(i.A,{onClick:e=>{e.stopPropagation(),p(!1)}}):(0,c.createElement)(s.A,{onClick:e=>{e.stopPropagation(),p(!0)}})))),(0,c.createElement)("div",{className:"content-restriction__header__action content-restriction__header__action--right"},(0,c.createElement)("button",{className:"content-restriction__btn content-restriction__btn--create",onClick:j},n?(0,E.__)("Update","content-restriction"):(0,E.__)("Publish","content-restriction")))))}var y=n(2318),v=n(1005),S=n(441);function I(e){const{id:t,type:n,openKey:r,setOpenKey:a,changeAction:i,resetType:s}=e,l=(0,o.useRef)(null);(0,o.useEffect)((()=>{const e=e=>{!l.current||l.current.contains(e.target)||e.target.closest(".ant-dropdown-trigger")||setTimeout((()=>{a(null)}),100)};return document.addEventListener("mousedown",e),()=>{document.removeEventListener("mousedown",e)}}),[a]);const _=[{key:"remove",label:(0,c.createElement)("a",{onClick:e=>{e.stopPropagation(),s(e,n)}},(0,E.__)("Remove","content-restriction"))},{key:"change",label:(0,c.createElement)("a",{onClick:e=>{e.stopPropagation(),i(e,n)}},(0,E.__)("Change","content-restriction"))}],m=r===n;return(0,c.createElement)("div",{ref:l},(0,c.createElement)(S.A,{menu:{items:_},trigger:["click"],placement:"bottomRight",open:!t&&m,onOpenChange:()=>{a(n)}},(0,c.createElement)("button",{className:"content-restriction__single__btn__action",onClick:e=>{e.stopPropagation(),t?i(e,n):a(n)}},t?(0,c.createElement)(v.A,null):(0,c.createElement)(y.A,null))))}function C(e){return"string"!=typeof e?"":e.replace(/[^a-zA-Z0-9]/g," ").split(/[\s_]+/).map((e=>e.charAt(0).toUpperCase()+e.slice(1))).join(" ")}const T="data:image/svg+xml;base64,PHN2ZyBmaWxsPSJub25lIiBoZWlnaHQ9IjQ4IiB2aWV3Qm94PSIwIDAgNDAgNDgiIHdpZHRoPSI0MCIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48cGF0aCBjbGlwLXJ1bGU9ImV2ZW5vZGQiIGQ9Im0yMCA0NGMxMS4wNDU3IDAgMjAtOC45NTQzIDIwLTIwcy04Ljk1NDMtMjAtMjAtMjBjLTExLjA0NTcyIDAtMjAgOC45NTQzLTIwIDIwczguOTU0MjggMjAgMjAgMjB6bTYuMjM5My0zMC42ODMyYy4zMDM3LTEuMDc4Ny0uNzQzMi0xLjcxNjctMS42OTkzLTEuMDM1NWwtMTMuMzQ2OSA5LjUwODNjLTEuMDM2OS43Mzg3LS44NzM4IDIuMjEwNC4yNDUgMi4yMTA0aDMuNTE0NnYtLjAyNzJoNi44NDk4bC01LjU4MTMgMS45NjkzLTIuNDYwNSA4Ljc0MTFjLS4zMDM3IDEuMDc4OC43NDMxIDEuNzE2NyAxLjY5OTMgMS4wMzU1bDEzLjM0NjktOS41MDgyYzEuMDM2OS0uNzM4Ny44NzM3LTIuMjEwNS0uMjQ1LTIuMjEwNWgtNS4zMjk4eiIgZmlsbD0iIzE1NWVlZiIgZmlsbC1ydWxlPSJldmVub2RkIi8+PC9zdmc+";var j=n(7072);const f=()=>(0,c.createElement)(c.Fragment,null,(0,c.createElement)("li",{className:"content-restriction__type__item"},(0,c.createElement)("button",{className:"content-restriction__type__btn"},(0,c.createElement)(j.A,{active:!0,paragraph:{rows:4}}))),(0,c.createElement)("li",{className:"content-restriction__type__item"},(0,c.createElement)("button",{className:"content-restriction__type__btn"},(0,c.createElement)(j.A,{active:!0,paragraph:{rows:4}}))),(0,c.createElement)("li",{className:"content-restriction__type__item"},(0,c.createElement)("button",{className:"content-restriction__type__btn"},(0,c.createElement)(j.A,{active:!0,paragraph:{rows:4}}))),(0,c.createElement)("li",{className:"content-restriction__type__item"},(0,c.createElement)("button",{className:"content-restriction__type__btn"},(0,c.createElement)(j.A,{active:!0,paragraph:{rows:4}}))),(0,c.createElement)("li",{className:"content-restriction__type__item"},(0,c.createElement)("button",{className:"content-restriction__type__btn"},(0,c.createElement)(j.A,{active:!0,paragraph:{rows:4}}))),(0,c.createElement)("li",{className:"content-restriction__type__item"},(0,c.createElement)("button",{className:"content-restriction__type__btn"},(0,c.createElement)(j.A,{active:!0,paragraph:{rows:4}})))),D=()=>{const e=(0,l.select)("content-restriction-stores"),[t,n]=(0,o.useState)(e.getRuleType()||"who-can-see"),[r,a]=(0,o.useState)([]),[i,s]=(0,o.useState)([]),[_,m]=(0,o.useState)(""),[d,h]=(0,o.useState)(!1),[p,M]=(0,o.useState)(e.getModal()||!1),[N,b]=(0,o.useState)("-"),[w,y]=(0,o.useState)("-"),v=(0,l.subscribe)((()=>{const t=e.getModal(),c=e.getRuleType();M(t),n(c),"restrict-view"===c&&(b((0,E.__)("How should the content be protected?","content-restriction")),y((0,E.__)("When user does not have access permission, the following options help control their experience.","content-restriction"))),"what-content"===c&&(b((0,E.__)("What content will be unlocked?","content-restriction")),y((0,E.__)("When user have access permission, the following content will be available.","content-restriction"))),"who-can-see"===c&&(b((0,E.__)("Who can see the content?","content-restriction")),y((0,E.__)("Which user type should be allowed to see the content.","content-restriction")))}));(0,o.useEffect)((()=>(M(e.getModal()),()=>v())));const S=()=>{M(e.getModal());const n=e.getWhatContent(),c=e.getWhoCanSee(),r=e.getRestrictView();t&&g(`content-restriction/modules/${t}`,{what_content:n?.key,who_can_see:c?.key,restrict_view:r?.key}).then((e=>{a(e),h(!0);let i=null;"who-can-see"===t?i=c?.key:"what-content"===t?i=n?.key:"restrict-view"===t&&(i=r?.key);const s=e.find((e=>e.key===i));s&&("who-can-see"===t?(0,l.dispatch)(u).setWhoCanSee(s):"what-content"===t?(0,l.dispatch)(u).setWhatContent(s):"restrict-view"===t&&(0,l.dispatch)(u).setRestrictView(s))}))};(0,o.useEffect)((()=>{S(),h(!1)}),[t]),(0,o.useEffect)((()=>{const e=r.reduce(((e,t)=>{const n=t.group||"others";return e[n]||(e[n]=[]),e[n].push(t),e}),{}),t=Object.keys(e);s(t)}),[r]),(0,o.useEffect)((()=>{S()}),[]);const I=()=>{(0,l.dispatch)(u).setModalVisible(!1)};return(0,c.createElement)("div",{className:"content-restriction__modal "+(p?"content-restriction__modal--visible":"")},(0,c.createElement)("div",{className:"content-restriction__modal__overlay",onClick:I}),(0,c.createElement)("div",{className:"content-restriction__modal__content"},(0,c.createElement)("div",{className:"content-restriction__modal__content__header"},(0,c.createElement)("div",{className:"content-restriction__modal__content__header__info"},(0,c.createElement)("div",{class:"info-text"},(0,c.createElement)("h2",{class:"content-restriction__modal__content__title"},N),(0,c.createElement)("p",{class:"content-restriction__modal__content__desc"},w))),(0,c.createElement)("div",{className:"content-restriction__modal__content__header__action"},(0,c.createElement)("button",{className:"content-restriction__modal__content__close-btn",onClick:I},"x"))),(0,c.createElement)("div",{className:"content-restriction__modal__content__body"},(0,c.createElement)("div",{className:"content-restriction__modal__content__wrapper"},(0,c.createElement)("div",{className:"content-restriction__module"},r.length>0?(0,c.createElement)(c.Fragment,null,i.length>0&&"what-content"===t&&(0,c.createElement)("ul",{className:"content-restriction__group"},(0,c.createElement)("li",{key:"all",className:"content-restriction__group__item"},(0,c.createElement)("button",{className:"content-restriction__group__btn "+(_?"":"active"),onClick:()=>m("")},"All")),i.map((e=>(0,c.createElement)("li",{key:e,className:"content-restriction__group__item"},(0,c.createElement)("button",{className:"content-restriction__group__btn "+(_===e?"active":""),onClick:()=>m(e)},e.split(" ").map((e=>e.charAt(0).toUpperCase()+e.slice(1).toLowerCase())).join(" ")))))),(0,c.createElement)("ul",{className:"content-restriction__type"},d?r.filter((e=>!_||("others"===_?!e.group:e.group===_))).map(((n,r)=>(0,c.createElement)("li",{className:"content-restriction__type__item "+(n.upcoming||n.is_pro&&!content_restriction_admin.pro_available?"pro-item":""),key:r},(0,c.createElement)("button",{className:"content-restriction__type__btn",onClick:n.upcoming||n.is_pro&&!content_restriction_admin.pro_available?void 0:()=>((t,n)=>{(0,l.dispatch)(u).setModalVisible(!1),(0,l.dispatch)(u).setSidebarVisible(!0),(0,l.dispatch)(u).setRuleType(t);const c={...e.getRuleData(),[t]:n.key};(0,l.dispatch)(u).setRule(c),"who-can-see"===t?(0,l.dispatch)(u).setWhoCanSee(n):"what-content"===t?(0,l.dispatch)(u).setWhatContent(n):"restrict-view"===t&&(0,l.dispatch)(u).setRestrictView(n)})(t,n),title:n.is_pro?(0,E.__)("Upgrade Now","content-restriction"):n.upcoming?(0,E.__)("Upcoming","content-restriction"):""},n.upcoming&&(0,c.createElement)("span",{className:"upcoming-badge"},(0,E.__)("Upcoming","content-restriction")),n.is_pro&&content_restriction_admin.pro_available&&(0,c.createElement)("span",{className:"pro-badge"},(0,c.createElement)("svg",{width:"20",height:"20",viewBox:"0 0 12 12",fill:"none",xmlns:"http://www.w3.org/2000/svg"},(0,c.createElement)("g",{clipPath:"url(#clip0_457_540)"},(0,c.createElement)("path",{d:"M12 3.06766C12 2.40317 11.4594 1.86264 10.795 1.86264C10.1305 1.86264 9.58997 2.40317 9.58997 3.06766C9.58997 3.61594 9.61278 4.33792 9.16941 4.66046L8.70365 4.9993C8.219 5.35188 7.53519 5.20188 7.24262 4.67881L7.01772 4.27675C6.7391 3.77861 7.00523 3.12326 7.14059 2.56878C7.16295 2.47719 7.1748 2.38153 7.1748 2.28314C7.1748 1.61865 6.63428 1.07812 5.96979 1.07812C5.3053 1.07812 4.76477 1.61865 4.76477 2.28314C4.76477 2.39417 4.77986 2.50174 4.80809 2.6039C4.95811 3.1467 5.23419 3.78222 4.97543 4.2824L4.80172 4.61819C4.51816 5.16632 3.81066 5.32929 3.31588 4.96046L2.82316 4.59317C2.37951 4.26245 2.41013 3.53404 2.41013 2.98068C2.41013 2.31619 1.8696 1.77567 1.20511 1.77567C0.540527 1.77567 0 2.31619 0 2.98068C0 3.33173 0.150933 3.64809 0.391293 3.86846C0.666239 4.12054 0.977007 4.37886 1.06625 4.74104L2.29778 9.73924C2.40786 10.186 2.80861 10.5 3.26874 10.5H8.80645C9.26982 10.5 9.6725 10.1817 9.77945 9.73081L10.9414 4.83229C11.028 4.46732 11.3394 4.20557 11.6143 3.95037C11.8514 3.73024 12 3.41603 12 3.06766Z",fill:"#F17D0E"})),(0,c.createElement)("defs",null,(0,c.createElement)("clipPath",{id:"clip0_457_540"},(0,c.createElement)("rect",{width:"12",height:"12",fill:"white"}))))),(0,c.createElement)("img",{src:n?.icon||T,alt:n.name}),(0,c.createElement)("h3",null,n.name),(0,c.createElement)("span",null,n.desc))))):(0,c.createElement)(f,null))):"")))))};var k=n(7256),A=n(2154),z=n(1575);function R(e){return Object.entries(e||{}).map((([e,t])=>({value:e,label:"string"==typeof t?t:t.title})))}const{TextArea:L}=k.A,x=()=>{const[e,t]=(0,o.useState)(!1),[n,r]=(0,o.useState)("Action"),[a,i]=(0,o.useState)(),[s,_]=(0,o.useState)(!1),[m,d]=(0,o.useState)(!1),[h,p]=(0,o.useState)(null),[g,M]=(0,o.useState)([]),[N,b]=(0,o.useState)(null),[w,y]=(0,o.useState)({}),[v,S]=(0,o.useState)("");(0,o.useEffect)((()=>{const e=(0,l.select)("content-restriction-stores");_(e.getSidebar());const n=(0,l.subscribe)((()=>{const n=e.getSidebar(),c=e.getRuleType(),a=e.getRuleData(),s=e.getWhoCanSee(),l=e.getWhatContent(),o=e.getRestrictView();_(n),t(c),y(a),"who-can-see"===c?(i(s),r(s.name)):"what-content"===c?(i(l),r(l.name)):"restrict-view"===c&&(i(o),r(o.name))}));return()=>n()}));const I=(t,n)=>{y((c=>({...c,[e]:{[a.key]:{...c[e]?.[a.key],[t]:n}}})))};return(0,o.useEffect)((()=>{const e=w&&w["what-content"];if(e&&"object"==typeof e)for(const[t,n]of Object.entries(e))S(t);else S(e);(0,l.dispatch)(u).setRule(w)}),[w]),(0,o.useEffect)((()=>{if(p(null),M(null),b(null),a&&!a?.options)y((t=>({...t,[e]:a?.key})));else if(a&&e&&w&&w[e]?.[a.key]){const t=w[e][a.key];if("string"==typeof t||"number"==typeof t)p(t),M([]),b([]);else if("object"==typeof t){const e=Object.keys(t)[0];if(p(e),Array.isArray(t[e])){b(t[e]);const n=a.options[e];if(n&&"multi-select"===n.type){const e=Object.entries(n.options||{}).map((([e,t])=>({value:e,label:t})));M(e)}}else M([]),b([])}}else y((t=>({...t,[e]:a?.key})))}),[a]),(0,c.createElement)("div",{className:"content-restriction__sidebar "+(s?"content-restriction__sidebar--visible":"")},a?(0,c.createElement)("div",{className:"content-restriction__sidebar__content"},(0,c.createElement)("div",{className:"content-restriction__sidebar__content__header"},(0,c.createElement)("h2",{className:"content-restriction__sidebar__content__title"},n),(0,c.createElement)("button",{className:"content-restriction__sidebar__content__btn",onClick:e=>(e=>{e.stopPropagation(),(0,l.dispatch)(u).setSidebarVisible(!1),(0,l.dispatch)(u).setModalVisible(!0)})(e)},(0,E.__)("Change","content-restriction")),(0,c.createElement)("button",{className:"content-restriction__sidebar__content__close-btn",onClick:()=>{(0,l.dispatch)(u).setSidebarVisible(!1)}},"x")),(0,c.createElement)("div",{className:"content-restriction__sidebar__content__body"},(0,c.createElement)("div",{className:"content-restriction__sidebar__tab"},(0,c.createElement)("div",{className:"tab-content content-restriction__sidebar__tab__content",id:"nav-tabContent"},(0,c.createElement)("div",{className:"content-restriction__sidebar__tab__content__event"},(0,c.createElement)("div",{className:"content-restriction__sidebar__tab__content__event__wrapper"},"select"===a?.type?(0,c.createElement)(c.Fragment,null,(0,c.createElement)("h3",{className:"content-restriction__sidebar__tab__content__event__title"},(0,E.__)("Select ","content-restriction")," ",a?.name,"   ",(0,E.__)("(required) ","content-restriction")),(0,c.createElement)(A.A,{allowClear:!0,style:{width:"100%",marginBottom:"10px"},placeholder:(0,E.__)("Please select an option","content-restriction"),onChange:t=>{const n=a.options[t];if(p(t),b([]),n&&"object"==typeof n&&"multi-select"===n.type){const c=Object.entries(n.options||{}).map((([e,t])=>({value:e,label:t})));M(c),y((n=>({...n,[e]:{[a.key]:{[t]:[]}}})))}else n?(M([]),y((n=>({...n,[e]:{[a.key]:t}})))):M([])},options:R(a?.options),value:h}),h&&g.length>0&&(0,c.createElement)(c.Fragment,null,(0,c.createElement)("h3",{className:"content-restriction__sidebar__tab__content__event__title"}," ",(0,E.__)("Choose","content-restriction")," ",C(h)),(0,c.createElement)(A.A,{mode:"multiple",allowClear:!0,style:{width:"100%"},placeholder:`Select ${h} option`,onChange:t=>{b(t),y((n=>({...n,[e]:{[a.key]:{[h]:t}}})))},options:g,value:N}))):"section"===a?.type?(0,c.createElement)(c.Fragment,null,a.options&&Object.entries(a.options).length>0?Object.entries(a.options).map((([t,n])=>"text"===n.type||"url"===n.type?(0,c.createElement)("div",{className:"content-restriction__sidebar__tab__content__event__section-wrapper",key:t},(0,c.createElement)("h3",{className:"content-restriction__sidebar__tab__content__event__title"},n.title),(0,c.createElement)(k.A,{id:`content-restriction__${t}`,placeholder:`Type ${n.title}`,value:w&&w[e]?.[a.key]?.[t]||"",onChange:e=>I(t,e.target.value)})):"textarea"===n.type?(0,c.createElement)("div",{className:"content-restriction__sidebar__tab__content__event__section-wrapper",key:t},(0,c.createElement)("h3",{className:"content-restriction__sidebar__tab__content__event__title"},n.title),(0,c.createElement)(L,{id:`content-restriction__${t}`,rows:4,placeholder:`Type ${n.title}`,value:w&&w[e]?.[a.key]?.[t]||"",onChange:e=>I(t,e.target.value)})):"range"===n.type?(0,c.createElement)("div",{className:"content-restriction__sidebar__tab__content__event__section-wrapper",key:t},(0,c.createElement)("h3",{className:"content-restriction__sidebar__tab__content__event__title"},n.title),(0,c.createElement)(z.A,{defaultValue:n.default,value:w&&w[e]?.[a.key]?.[t]||n.default,onChange:e=>I(t,e)})):"multi-select"===n.type?(0,c.createElement)("div",{className:"content-restriction__sidebar__tab__content__event__section-wrapper",key:t},(0,c.createElement)("h3",{className:"content-restriction__sidebar__tab__content__event__title"},n.title),(0,c.createElement)(A.A,{mode:"multiple",allowClear:!0,style:{width:"100%"},placeholder:(0,E.__)("Please select","content-restriction"),onChange:e=>I(t,e),options:R(n.options),value:w&&w[e]?.[a.key]?.[t]||[]})):null)):(0,c.createElement)("div",null,(0,E.__)("No options available","content-restriction"))):(0,c.createElement)(c.Fragment,null,(0,c.createElement)("p",{className:"content-restriction__sidebar__tab__content__event__desc"},a?.desc)))))))):null)},O=()=>(0,c.createElement)(c.Fragment,null,(0,c.createElement)("div",{className:"content-restriction__single__btn"},(0,c.createElement)(j.A,{active:!0,title:!1,paragraph:{rows:1,width:"100%"}})));function V(){const[e,t]=(0,o.useState)(null),[n,r]=(0,o.useState)([]),[a,i]=(0,o.useState)(""),[s,_]=(0,o.useState)(""),[m,d]=(0,o.useState)(""),[h,p]=(0,o.useState)(null),[M,N]=(0,o.useState)(!1),[b,w]=(0,o.useState)(T),[y,v]=(0,o.useState)(T),[S,j]=(0,o.useState)(T),f={name:"",key:"",type:"",options:""};(0,o.useEffect)((()=>{const e=window.location.href.split("/"),n=e[e.length-1];if("rule"===n)return N(!0),(0,l.dispatch)(u).setWhoCanSee(f),(0,l.dispatch)(u).setWhatContent(f),(0,l.dispatch)(u).setRestrictView(f),(0,l.dispatch)(u).setRuleTitle(""),(0,l.dispatch)(u).setRulePublished(""),(0,l.dispatch)(u).setId(""),void(0,l.dispatch)(u).setRule("");t(e[6]),g("content-restriction/rules/list").then((e=>{r(e);const t=e.length>0&&e.find((e=>e.id===n));(0,l.dispatch)(u).setId(t?.id),(0,l.dispatch)(u).setRule(t?.rule),(0,l.dispatch)(u).setRulePublished(t?.status),(0,l.dispatch)(u).setRuleTitle(t?.title);const c=t&&t?.rule["who-can-see"]?"object"==typeof t?.rule["who-can-see"]?Object.keys(t?.rule["who-can-see"])[0]:"string"==typeof t?.rule["who-can-see"]?t?.rule["who-can-see"]:"":"",a=t&&t?.rule["what-content"]?"object"==typeof t?.rule["what-content"]?Object.keys(t?.rule["what-content"])[0]:"string"==typeof t?.rule["what-content"]?t?.rule["what-content"]:"":"",s=t&&t?.rule["restrict-view"]?"object"==typeof t?.rule["restrict-view"]?Object.keys(t?.rule["restrict-view"])[0]:"string"==typeof t?.rule["restrict-view"]?t?.rule["restrict-view"]:"":"";i(C(c)),_(C(a)),d(C(s));const o=async(e,t)=>{try{const n=(e&&await g(`content-restriction/modules/${e}`,{what_content:a,who_can_see:c,restrict_view:s})).find((e=>e.key===t));n&&("who-can-see"===e?(0,l.dispatch)(u).setWhoCanSee(n):"what-content"===e?(0,l.dispatch)(u).setWhatContent(n):"restrict-view"===e&&(0,l.dispatch)(u).setRestrictView(n))}catch(e){}};o("who-can-see",c),o("what-content",a),o("restrict-view",s),N(!0)})).catch((e=>{}))}),[]),(0,o.useEffect)((()=>{const e=(0,l.select)("content-restriction-stores"),t=(0,l.subscribe)((()=>{var t,n,c;const r=e.getWhoCanSee(),a=e.getWhatContent(),s=e.getRestrictView();i(r.name),_(a.name),d(s.name),w(null!==(t=r.icon)&&void 0!==t?t:b),v(null!==(n=a.icon)&&void 0!==n?n:y),j(null!==(c=s.icon)&&void 0!==c?c:S)}));return()=>t()}),[n]);const k=(e,t)=>{e.stopPropagation(),(0,l.dispatch)(u).setRuleType(t),"who-can-see"===t?a?z():A():"what-content"===t?s?z():A():"restrict-view"===t&&(m?z():A())},A=()=>{p(null),(0,l.dispatch)(u).setModalVisible(!0)},z=()=>{p(null),(0,l.dispatch)(u).setSidebarVisible(!0)},R=(e,t)=>{e.stopPropagation(),(0,l.dispatch)(u).setModalVisible(!1),(0,l.dispatch)(u).setSidebarVisible(!1),"who-can-see"===t?(i(""),(0,l.dispatch)(u).setWhoCanSee(f)):"what-content"===t?(_(""),(0,l.dispatch)(u).setWhatContent(f)):"restrict-view"===t&&(d(""),(0,l.dispatch)(u).setRestrictView(f))},L=(e,t)=>{e.stopPropagation(),p(null),(0,l.dispatch)(u).setRuleType(t),(0,l.dispatch)(u).setModalVisible(!0)};return(0,c.createElement)(c.Fragment,null,(0,c.createElement)("section",{className:"content-restriction__create-rules"},M?(0,c.createElement)(c.Fragment,null,(0,c.createElement)("div",{className:"content-restriction__single"},(0,c.createElement)("div",{className:"content-restriction__single__btn",onClick:e=>k(e,"who-can-see")},(0,c.createElement)("img",{src:b}),a?(0,c.createElement)(c.Fragment,null,(0,c.createElement)("h3",{className:"content-restriction__single__btn__title"},a),(0,c.createElement)(I,{id:e,type:"who-can-see",openKey:h,setOpenKey:p,changeAction:L,resetType:R})):(0,c.createElement)("h3",{className:"content-restriction__single__btn__title"},(0,E.__)("Who can see the content?","content-restriction")))),(0,c.createElement)("div",{className:"content-restriction__single"},(0,c.createElement)("div",{className:"content-restriction__single__btn "+(a?"":"disabled"),onClick:e=>k(e,"what-content")},(0,c.createElement)("img",{src:y}),s?(0,c.createElement)(c.Fragment,null,(0,c.createElement)("h3",{className:"content-restriction__single__btn__title"},s),(0,c.createElement)(I,{id:e,type:"what-content",openKey:h,setOpenKey:p,changeAction:L,resetType:R})):(0,c.createElement)("h3",{className:"content-restriction__single__btn__title"},(0,E.__)("What content will be unlocked?","content-restriction")))),(0,c.createElement)("div",{className:"content-restriction__single"},(0,c.createElement)("div",{className:"content-restriction__single__btn "+(a&&s?"":"disabled"),onClick:e=>k(e,"restrict-view")},(0,c.createElement)("img",{src:S}),m?(0,c.createElement)(c.Fragment,null,(0,c.createElement)("h3",{className:"content-restriction__single__btn__title"},m),(0,c.createElement)(I,{id:e,type:"restrict-view",openKey:h,setOpenKey:p,changeAction:L,resetType:R})):(0,c.createElement)("h3",{className:"content-restriction__single__btn__title"},(0,E.__)("How should the content be protected?","content-restriction"))))):(0,c.createElement)(c.Fragment,null,(0,c.createElement)(O,null),(0,c.createElement)(O,null),(0,c.createElement)(O,null))),(0,c.createElement)(D,null),(0,c.createElement)(x,null))}function W(){return(0,c.createElement)(c.Fragment,null,(0,c.createElement)(w,null),(0,c.createElement)(V,null))}var U=n(9266);const P=[{key:"rules",label:(0,c.createElement)(r.N_,{to:"/rules",className:"content-restriction__menu__single"},(0,E.__)("Rules","content-restriction"))},{key:"integrations",label:(0,c.createElement)(r.N_,{to:"/integrations",className:"content-restriction__menu__single"},(0,E.__)("Integrations","content-restriction"))},{key:"license",label:content_restriction_admin.pro_available?"":(0,c.createElement)("a",{href:"https://contentrestriction.com/pricing/?utm_source=wp-plugins&utm_campaign=upgrade-to-pro&utm_medium=wp-dash",target:"_blank",className:"upgrade-to-pro"},(0,c.createElement)("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",xmlns:"http://www.w3.org/2000/svg"},(0,c.createElement)("g",{"clip-path":"url(#clip0_457_540)"},(0,c.createElement)("path",{d:"M12 3.06766C12 2.40317 11.4594 1.86264 10.795 1.86264C10.1305 1.86264 9.58997 2.40317 9.58997 3.06766C9.58997 3.61594 9.61278 4.33792 9.16941 4.66046L8.70365 4.9993C8.219 5.35188 7.53519 5.20188 7.24262 4.67881L7.01772 4.27675C6.7391 3.77861 7.00523 3.12326 7.14059 2.56878C7.16295 2.47719 7.1748 2.38153 7.1748 2.28314C7.1748 1.61865 6.63428 1.07812 5.96979 1.07812C5.3053 1.07812 4.76477 1.61865 4.76477 2.28314C4.76477 2.39417 4.77986 2.50174 4.80809 2.6039C4.95811 3.1467 5.23419 3.78222 4.97543 4.2824L4.80172 4.61819C4.51816 5.16632 3.81066 5.32929 3.31588 4.96046L2.82316 4.59317C2.37951 4.26245 2.41013 3.53404 2.41013 2.98068C2.41013 2.31619 1.8696 1.77567 1.20511 1.77567C0.540527 1.77567 0 2.31619 0 2.98068C0 3.33173 0.150933 3.64809 0.391293 3.86846C0.666239 4.12054 0.977007 4.37886 1.06625 4.74104L2.29778 9.73924C2.40786 10.186 2.80861 10.5 3.26874 10.5H8.80645C9.26982 10.5 9.6725 10.1817 9.77945 9.73081L10.9414 4.83229C11.028 4.46732 11.3394 4.20557 11.6143 3.95037C11.8514 3.73024 12 3.41603 12 3.06766Z",fill:"#F17D0E"})),(0,c.createElement)("defs",null,(0,c.createElement)("clipPath",{id:"clip0_457_540"},(0,c.createElement)("rect",{width:"12",height:"12",fill:"white"})))),(0,E.__)("Upgrade Now","content-restriction"))}];function H({menuKey:e}){return(0,c.createElement)(U.A,{selectedKeys:[e],mode:"horizontal",items:P,lineWidth:"0",style:{width:"100%",lineHeight:"70px"}})}function Q({menuKey:e}){return(0,c.createElement)(c.Fragment,null,(0,c.createElement)("div",{className:"content-restriction__header"},(0,c.createElement)("div",{className:"content-restriction__header__action content-restriction__header__action--left"},(0,c.createElement)(r.N_,{to:"/",className:"content-restriction__menu__single"},(0,c.createElement)("img",{src:"data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSI0MyIgaGVpZ2h0PSI0MyIgdmlld0JveD0iMCAwIDQzIDQzIiBmaWxsPSJub25lIj4KPHBhdGggZD0iTTAgM0MwIDEuMzQzMTQgMS4zNDMxNSAwIDMgMEg0MEM0MS42NTY5IDAgNDMgMS4zNDMxNSA0MyAzVjQwQzQzIDQxLjY1NjkgNDEuNjU2OSA0MyA0MCA0M0gzQzEuMzQzMTQgNDMgMCA0MS42NTY5IDAgNDBWM1oiIGZpbGw9IiMzNzQ3RDYiLz4KPHBhdGggZD0iTTEyLjM5MDkgMTMuNjYzSDEzLjU0MTkiIHN0cm9rZT0id2hpdGUiIHN0cm9rZS13aWR0aD0iMS41IiBzdHJva2UtbGluZWNhcD0icm91bmQiIHN0cm9rZS1saW5lam9pbj0icm91bmQiLz4KPHBhdGggZD0iTTE2LjY1NDggMTMuNjYzSDI3LjE5NTMiIHN0cm9rZT0id2hpdGUiIHN0cm9rZS13aWR0aD0iMS41IiBzdHJva2UtbGluZWNhcD0icm91bmQiIHN0cm9rZS1saW5lam9pbj0icm91bmQiLz4KPHBhdGggZD0iTTE2LjM2NjkgMjkuNDI5NUMxNi4zNjY5IDI4LjM5OTUgMTYuMzY2OSAyNy45MTE2IDE2LjcxMjMgMjcuNTg2NEMxNy4wNTc2IDI3LjI2MTEgMTcuNTc1NiAyNy4yNjExIDE4LjY2OTEgMjcuMjYxMUgyMy4yNzM0QzI0LjM2NjkgMjcuMjYxMSAyNC44ODQ5IDI3LjI2MTEgMjUuMjMwMyAyNy41ODY0QzI1LjU3NTYgMjcuOTExNiAyNS41NzU2IDI4LjM5OTUgMjUuNTc1NiAyOS40Mjk1VjMwLjUxMzdDMjUuNTc1NiAzMi4wMzE1IDI1LjU3NTYgMzIuNzkwNSAyNS4wNTc2IDMzLjI3ODNDMjQuNTM5NiAzMy43NjYyIDIzLjczMzggMzMuNzY2MiAyMi4xMjIzIDMzLjc2NjJIMTkuODIwMkMxOC4yMDg3IDMzLjc2NjIgMTcuNDAyOSAzMy43NjYyIDE2Ljg4NDkgMzMuMjc4M0MxNi4zNjY5IDMyLjc5MDUgMTYuMzY2OSAzMi4wMzE1IDE2LjM2NjkgMzAuNTEzN1YyOS40Mjk1WiIgc3Ryb2tlPSIjRkZFNUQ2IiBzdHJva2Utd2lkdGg9IjEuNSIgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIi8+CjxwYXRoIGQ9Ik0yMy4yNzMzIDI2LjcxOTFWMjYuMTc3QzIzLjI3MzMgMjQuOTg0NCAyMi4yMzczIDI0LjAwODcgMjAuOTcxMSAyNC4wMDg3QzE5LjcwNDkgMjQuMDA4NyAxOC42Njg5IDI0Ljk4NDQgMTguNjY4OSAyNi4xNzdWMjYuNzE5MSIgc3Ryb2tlPSIjRkZFNUQ2IiBzdHJva2Utd2lkdGg9IjEuNSIgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIi8+CjxwYXRoIGQ9Ik0xMi42ODM1IDMyLjU1MTFDMTAuNjExNSAzMi4zMzQzIDkgMzAuNzA4IDkgMjguNzAyMlYxMy45MDMxQzkgMTEuNzM0NyAxMC44NDE3IDEwIDEzLjE0MzkgMTBIMjguODU2MUMzMS4xNTgzIDEwIDMzIDExLjczNDcgMzMgMTMuOTAzMVYyOC43MDIyQzMzIDMwLjcwOCAzMS4zODg1IDMyLjMzNDMgMjkuMzE2NSAzMi41NTExIiBzdHJva2U9IndoaXRlIiBzdHJva2Utd2lkdGg9IjIiIHN0cm9rZS1taXRlcmxpbWl0PSIxMCIgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIi8+CjxwYXRoIGQ9Ik05LjIzNDEzIDE2Ljc3NTZIMzIuNzA5MSIgc3Ryb2tlPSJ3aGl0ZSIgc3Ryb2tlLXdpZHRoPSIxLjUiIHN0cm9rZS1taXRlcmxpbWl0PSIxMCIgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIi8+Cjwvc3ZnPg==",alt:"{__( 'Content Restriction', 'content-restriction' )}"})),(0,c.createElement)("div",{className:"content-restriction__menu__single__name"},(0,c.createElement)("span",null,"All-in-One"),(0,c.createElement)("span",{className:"content-restriction__menu__single__name__highlight"},(0,E.__)("Content Restriction","content-restriction")))),(0,c.createElement)("div",{className:"content-restriction__header__action content-restriction__header__action--right"},(0,c.createElement)(H,{menuKey:e}))))}function Y({timestamp:e}){return Z(1e3*e)}const Z=e=>{const t=new Date,n=new Date(e),c=Math.floor((t-n)/1e3);let r=Math.floor(c/31536e3);return r>=1?1===r?(0,E.__)(" 1 year ago","content-restriction"):r+(0,E.__)(" years ago","content-restriction"):(r=Math.floor(c/2592e3),r>=1?1===r?(0,E.__)(" 1 month ago","content-restriction"):r+(0,E.__)(" months ago","content-restriction"):(r=Math.floor(c/86400),r>=1?1===r?(0,E.__)(" 1 day ago","content-restriction"):r+(0,E.__)(" days ago","content-restriction"):(r=Math.floor(c/3600),r>=1?1===r?(0,E.__)(" 1 hour ago","content-restriction"):r+(0,E.__)(" hours ago","content-restriction"):(r=Math.floor(c/60),r>=1?1===r?(0,E.__)(" 1 minute ago","content-restriction"):r+(0,E.__)(" minutes ago","content-restriction"):1===Math.floor(c)?(0,E.__)(" 1 second ago","content-restriction"):Math.floor(c)+(0,E.__)(" seconds ago","content-restriction")))))};var B=n(2609),F=n(955);const G=()=>(0,c.createElement)(c.Fragment,null,(0,c.createElement)("tr",null,(0,c.createElement)("td",null,(0,c.createElement)(j.A,{active:!0,title:!1,paragraph:{rows:1,width:"100%"}})),(0,c.createElement)("td",null,(0,c.createElement)(j.A,{active:!0,title:!1,paragraph:{rows:1,width:"100%"}})),(0,c.createElement)("td",null,(0,c.createElement)(j.A,{active:!0,title:!1,paragraph:{rows:1,width:"100%"}})),(0,c.createElement)("td",null,(0,c.createElement)(j.A,{active:!0,title:!1,paragraph:{rows:1,width:"100%"}}))));function J(){const e=(0,a.Zp)(),[t,n]=(0,o.useState)([]),[i,s]=(0,o.useState)({}),[_,m]=(0,o.useState)(!1);return(0,o.useEffect)((()=>{const e=t.reduce(((e,t)=>(e[t.id]=t.status,e)),{});s(e)}),[t]),(0,o.useEffect)((()=>{g("content-restriction/rules/list").then((e=>{n(e),m(!0)})).catch((e=>{b("error",(0,E.__)("Something wen't wrong!","content-restriction"))})),(0,l.dispatch)(u).setSidebarVisible(!1)}),[]),(0,c.createElement)("div",{class:"content-restriction__rules relative"},(0,c.createElement)("table",{class:"content-restriction__rules__list"},(0,c.createElement)("thead",{class:"content-restriction__rules__list__header"},(0,c.createElement)("tr",null,(0,c.createElement)("th",{scope:"col",width:"5%"},(0,E.__)("Status","content-restriction")),(0,c.createElement)("th",{scope:"col"},(0,E.__)("Name","content-restriction")),(0,c.createElement)("th",{scope:"col"},(0,E.__)("Last edit","content-restriction")),(0,c.createElement)("th",{scope:"col",width:"5%",className:"text-center"},(0,E.__)("Actions","content-restriction")))),(0,c.createElement)("tbody",{class:"content-restriction__rules__body"},t.length>0?t.map(((t,n)=>(0,c.createElement)("tr",{key:n},(0,c.createElement)("td",null,(0,c.createElement)(B.A,{checked:i[t.id],onChange:e=>((e,t,n,c)=>{s({...i,[t]:e}),g("content-restriction/rules/update",{id:t,data:{status:e,title:n,rule:c}}).then((e=>{b("success",(0,E.__)("Successfully updated!","content-restriction"))})).catch((e=>{b("error",(0,E.__)("Status update error","content-restriction"))}))})(e,t.id,t.title,t.rule),checkedChildren:"",unCheckedChildren:""})),(0,c.createElement)("td",null,(0,c.createElement)(r.N_,{to:`/rule/${t.id}`},t.title)),(0,c.createElement)("td",null,(0,c.createElement)(Y,{timestamp:t.modified})),(0,c.createElement)("td",{className:"content-restriction__rules__action"},(0,c.createElement)(F.A,{title:(0,E.__)("Delete","content-restriction")},(0,c.createElement)("a",{href:"#",className:"delete-btn"},(0,c.createElement)("svg",{onClick:()=>{return n=t.id,c=e,void M({title:(0,E.__)("Are you sure you want to delete this item?","content-restriction"),content:(0,E.__)("This action cannot be undone.","content-restriction"),okText:(0,E.__)("Confirm","content-restriction"),okType:"danger",cancelText:(0,E.__)("Cancel","content-restriction"),onOk(){((e,t)=>{g(`content-restriction/rules/delete?id=${e}`).then((e=>{t("/rules"),window.location.reload()})).catch((e=>{}))})(n,c)},onCancel(){}});var n,c},width:"13",height:"18",viewBox:"0 0 304 384",xmlns:"http://www.w3.org/2000/svg"},(0,c.createElement)("path",{fill:"#CA0B00",d:"M21 341V85h256v256q0 18-12.5 30.5T235 384H64q-18 0-30.5-12.5T21 341M299 21v43H0V21h75L96 0h107l21 21z"})))),(0,c.createElement)(F.A,{title:"Edit"},(0,c.createElement)(r.N_,{to:`/rule/${t.id}`},(0,c.createElement)("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",height:"24",width:"24",size:"24",name:"actionEdit"},(0,c.createElement)("path",{fill:"#2D2E2E",d:"m16.92 5 3.51 3.52 1.42-1.42-4.93-4.93L3 16.09V21h4.91L19.02 9.9 17.6 8.48 7.09 19H5v-2.09L16.92 5Z"})))))))):_?(0,c.createElement)("tr",null,(0,c.createElement)("td",{colSpan:"4",className:"text-center"},(0,E.__)("No rules was found! Create new rule","content-restriction"))):(0,c.createElement)(c.Fragment,null,(0,c.createElement)(G,null),(0,c.createElement)(G,null),(0,c.createElement)(G,null)))))}function K(){return(0,c.createElement)(c.Fragment,null,(0,c.createElement)(Q,{menuKey:"rules"}),(0,c.createElement)("div",{className:"content-restriction__rules container"},(0,c.createElement)("div",{className:"content-restriction__rules__header"},(0,c.createElement)("h1",{className:"content-restriction__rules__header__title"},"Rules"),(0,c.createElement)(r.N_,{to:"/rule",className:"content-restriction__btn content-restriction__btn--create"},(0,c.createElement)("svg",{width:"15",height:"15",viewBox:"0 0 29 29",fill:"none",xmlns:"http://www.w3.org/2000/svg"},(0,c.createElement)("path",{d:"M15.2031 0.4375C15.5761 0.4375 15.9338 0.585658 16.1975 0.849381C16.4612 1.1131 16.6094 1.47079 16.6094 1.84375V12.3906H27.1562C27.5292 12.3906 27.8869 12.5388 28.1506 12.8025C28.4143 13.0662 28.5625 13.4239 28.5625 13.7969V15.2031C28.5625 15.5761 28.4143 15.9338 28.1506 16.1975C27.8869 16.4612 27.5292 16.6094 27.1562 16.6094H16.6094V27.1562C16.6094 27.5292 16.4612 27.8869 16.1975 28.1506C15.9338 28.4143 15.5761 28.5625 15.2031 28.5625H13.7969C13.4239 28.5625 13.0662 28.4143 12.8025 28.1506C12.5388 27.8869 12.3906 27.5292 12.3906 27.1562V16.6094H1.84375C1.47079 16.6094 1.1131 16.4612 0.849381 16.1975C0.585658 15.9338 0.4375 15.5761 0.4375 15.2031V13.7969C0.4375 13.4239 0.585658 13.0662 0.849381 12.8025C1.1131 12.5388 1.47079 12.3906 1.84375 12.3906H12.3906V1.84375C12.3906 1.47079 12.5388 1.1131 12.8025 0.849381C13.0662 0.585658 13.4239 0.4375 13.7969 0.4375H15.2031Z",fill:"white"})),(0,c.createElement)("span",null,(0,E.__)("Create Rule","content-restriction")))),(0,c.createElement)(J,null)))}const X=()=>(0,c.createElement)("div",{class:"content-restriction__integrations__list__item"},(0,c.createElement)("div",{class:"content-restriction__integrations__list__item__header"},(0,c.createElement)(j.A,{active:!0,title:!1,paragraph:{rows:8,width:"100%"}})));function $(){const[e,t]=(0,o.useState)([]),[n,r]=(0,o.useState)(!1);return(0,o.useEffect)((()=>{g("content-restriction/settings/integrations").then((e=>{t(e),r(!0)})).catch((e=>{b("error",(0,E.__)("Something wen't wrong!","content-restriction"))}))}),[]),(0,c.createElement)("div",{class:"content-restriction__integrations__list"},n?e.map(((e,t)=>(0,c.createElement)("div",{class:"content-restriction__integrations__list__item"},(0,c.createElement)("div",{class:"content-restriction__integrations__list__item__header"},(0,c.createElement)("img",{src:e.icon,alt:e.title}),(0,c.createElement)("div",{class:"badges"},e.badges.map(((e,t)=>(0,c.createElement)("span",{class:"badge"},C(e)))))),(0,c.createElement)("h3",{class:"content-restriction__integrations__list__item__title"},e.title),(0,c.createElement)("div",{class:"content-restriction__integrations__list__item__desc"},(0,c.createElement)("p",null,e.details)),(0,c.createElement)("p",{class:"content-restriction__integrations__list__item__actions"},e.link?(0,c.createElement)("a",{target:"__blank",href:e.link+"?utm_source=plugin&utm_medium=link&utm_campaign=integrations",class:"learn-more"},(0,E.__)("Learn more","content-restriction")):(0,c.createElement)("span",null),e.action&&"upgrade"===e.action?(0,c.createElement)("a",{href:"https://contentrestriction.com/pricing/?utm_source=wp-plugins&utm_campaign=upgrade-to-pro&utm_medium=wp-dash",class:"action upgrade-to-pro",target:"__blank"},(0,E.__)("Let's go","content-restriction")):"")))):(0,c.createElement)(c.Fragment,null,(0,c.createElement)(X,null),(0,c.createElement)(X,null),(0,c.createElement)(X,null),(0,c.createElement)(X,null),(0,c.createElement)(X,null),(0,c.createElement)(X,null),(0,c.createElement)(X,null),(0,c.createElement)(X,null),(0,c.createElement)(X,null),(0,c.createElement)(X,null)))}function q(){return(0,c.createElement)(c.Fragment,null,(0,c.createElement)(Q,{menuKey:"integrations"}),(0,c.createElement)("div",{className:"content-restriction__integrations container"},(0,c.createElement)("div",{className:"content-restriction__integrations__header"},(0,c.createElement)("h1",{className:"content-restriction__integrations__header__title"},(0,E.__)("Integrations","content-restriction")),(0,c.createElement)("p",null,(0,E.__)("Seamlessly integrate with other plugins to enhance your website’s content visibility and control functionality. Use advanced conditional rules to create a more personalized user experience.","content-restriction"))),(0,c.createElement)($,null)))}function ee(){return(0,c.createElement)(c.Fragment,null,(0,c.createElement)(w,null),(0,c.createElement)(V,null))}var te=n(5448);const{TextArea:ne}=k.A,{Option:ce}=A.A,{Sider:re,Content:ae}=te.A,{TextArea:ie}=k.A,se=function(){return(0,c.createElement)(c.Fragment,null,(0,c.createElement)(r.I9,null,(0,c.createElement)(a.BV,null,(0,c.createElement)(a.qh,{path:"/",element:(0,c.createElement)(K,null)}),(0,c.createElement)(a.qh,{path:"/rules",element:(0,c.createElement)(K,null)}),(0,c.createElement)(a.qh,{path:"/rule",element:(0,c.createElement)(W,null)}),(0,c.createElement)(a.qh,{path:"/rule/:id",element:(0,c.createElement)(ee,null)}),(0,c.createElement)(a.qh,{path:"/integrations",element:(0,c.createElement)(q,null)}))))}}}]);
  • content-restriction/tags/1.4.0/assets/dashboard-app.asset.php

    r3199191 r3294741  
    1 <?php return array('dependencies' => array('react', 'react-dom', 'wp-api-fetch', 'wp-data', 'wp-element', 'wp-i18n'), 'version' => 'e56767fde22f3d0ea646');
     1<?php return array('dependencies' => array('react', 'react-dom', 'wp-api-fetch', 'wp-data', 'wp-element', 'wp-i18n'), 'version' => '4f59a0fee0c4786e753e');
  • content-restriction/tags/1.4.0/assets/dashboard-app.js

    r3199191 r3294741  
    1 (()=>{"use strict";var e,t,r={1609:e=>{e.exports=window.React},5795:e=>{e.exports=window.ReactDOM},1455:e=>{e.exports=window.wp.apiFetch},7143:e=>{e.exports=window.wp.data},6087:e=>{e.exports=window.wp.element},7723:e=>{e.exports=window.wp.i18n}},n={};function o(e){var t=n[e];if(void 0!==t)return t.exports;var a=n[e]={exports:{}};return r[e](a,a.exports,o),a.exports}o.m=r,o.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return o.d(t,{a:t}),t},o.d=(e,t)=>{for(var r in t)o.o(t,r)&&!o.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},o.f={},o.e=e=>Promise.all(Object.keys(o.f).reduce(((t,r)=>(o.f[r](e,t),t)),[])),o.u=e=>e+".js?ver=1732849392540",o.miniCssF=e=>e+".css",o.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),o.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),e={},t="content-restriction:",o.l=(r,n,a,i)=>{if(e[r])e[r].push(n);else{var c,l;if(void 0!==a)for(var s=document.getElementsByTagName("script"),d=0;d<s.length;d++){var u=s[d];if(u.getAttribute("src")==r||u.getAttribute("data-webpack")==t+a){c=u;break}}c||(l=!0,(c=document.createElement("script")).charset="utf-8",c.timeout=120,o.nc&&c.setAttribute("nonce",o.nc),c.setAttribute("data-webpack",t+a),c.src=r),e[r]=[n];var p=(t,n)=>{c.onerror=c.onload=null,clearTimeout(m);var o=e[r];if(delete e[r],c.parentNode&&c.parentNode.removeChild(c),o&&o.forEach((e=>e(n))),t)return t(n)},m=setTimeout(p.bind(null,void 0,{type:"timeout",target:c}),12e4);c.onerror=p.bind(null,c.onerror),c.onload=p.bind(null,c.onload),l&&document.head.appendChild(c)}},o.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},(()=>{var e;o.g.importScripts&&(e=o.g.location+"");var t=o.g.document;if(!e&&t&&(t.currentScript&&"SCRIPT"===t.currentScript.tagName.toUpperCase()&&(e=t.currentScript.src),!e)){var r=t.getElementsByTagName("script");if(r.length)for(var n=r.length-1;n>-1&&(!e||!/^http(s?):/.test(e));)e=r[n--].src}if(!e)throw new Error("Automatic publicPath is not supported in this browser");e=e.replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),o.p=e})(),(()=>{if("undefined"!=typeof document){var e={699:0};o.f.miniCss=(t,r)=>{e[t]?r.push(e[t]):0!==e[t]&&{704:1}[t]&&r.push(e[t]=(e=>new Promise(((t,r)=>{var n=o.miniCssF(e),a=o.p+n;if(((e,t)=>{for(var r=document.getElementsByTagName("link"),n=0;n<r.length;n++){var o=(i=r[n]).getAttribute("data-href")||i.getAttribute("href");if("stylesheet"===i.rel&&(o===e||o===t))return i}var a=document.getElementsByTagName("style");for(n=0;n<a.length;n++){var i;if((o=(i=a[n]).getAttribute("data-href"))===e||o===t)return i}})(n,a))return t();((e,t,r,n,a)=>{var i=document.createElement("link");i.rel="stylesheet",i.type="text/css",o.nc&&(i.nonce=o.nc),i.onerror=i.onload=r=>{if(i.onerror=i.onload=null,"load"===r.type)n();else{var o=r&&r.type,c=r&&r.target&&r.target.href||t,l=new Error("Loading CSS chunk "+e+" failed.\n("+o+": "+c+")");l.name="ChunkLoadError",l.code="CSS_CHUNK_LOAD_FAILED",l.type=o,l.request=c,i.parentNode&&i.parentNode.removeChild(i),a(l)}},i.href=t,document.head.appendChild(i)})(e,a,0,t,r)})))(t).then((()=>{e[t]=0}),(r=>{throw delete e[t],r})))}}})(),(()=>{var e={699:0};o.f.j=(t,r)=>{var n=o.o(e,t)?e[t]:void 0;if(0!==n)if(n)r.push(n[2]);else{var a=new Promise(((r,o)=>n=e[t]=[r,o]));r.push(n[2]=a);var i=o.p+o.u(t),c=new Error;o.l(i,(r=>{if(o.o(e,t)&&(0!==(n=e[t])&&(e[t]=void 0),n)){var a=r&&("load"===r.type?"missing":r.type),i=r&&r.target&&r.target.src;c.message="Loading chunk "+t+" failed.\n("+a+": "+i+")",c.name="ChunkLoadError",c.type=a,c.request=i,n[1](c)}}),"chunk-"+t,t)}};var t=(t,r)=>{var n,a,i=r[0],c=r[1],l=r[2],s=0;if(i.some((t=>0!==e[t]))){for(n in c)o.o(c,n)&&(o.m[n]=c[n]);l&&l(o)}for(t&&t(r);s<i.length;s++)a=i[s],o.o(e,a)&&e[a]&&e[a][0](),e[a]=0},r=self.webpackChunkcontent_restriction=self.webpackChunkcontent_restriction||[];r.forEach(t.bind(null,0)),r.push=t.bind(null,r.push.bind(r))})();var a=o(1609),i=o(6087),c=o(7723);const l=()=>(0,a.createElement)("div",{className:"content-restriction__preloader"},(0,c.__)("Content Restriction Dashboard Loading...","content-restriction")),s=(0,i.lazy)((()=>Promise.all([o.e(305),o.e(704)]).then(o.bind(o,6704))));document.addEventListener("DOMContentLoaded",(function(){const e=document.getElementById("content-restriction-admin-dashboard-app");e&&function(e){i.createRoot?(0,i.createRoot)(e).render((0,a.createElement)("div",{class:"content-restriction"},(0,a.createElement)(i.Suspense,{fallback:(0,a.createElement)(l,null)},(0,a.createElement)(s,null)))):render((0,a.createElement)("div",{class:"content-restriction"},(0,a.createElement)(i.Suspense,{fallback:(0,a.createElement)(l,null)},(0,a.createElement)(s,null))),e)}(e)}))})();
     1(()=>{"use strict";var e,t,r={1455:e=>{e.exports=window.wp.apiFetch},1609:e=>{e.exports=window.React},5795:e=>{e.exports=window.ReactDOM},6087:e=>{e.exports=window.wp.element},7143:e=>{e.exports=window.wp.data},7723:e=>{e.exports=window.wp.i18n}},n={};function o(e){var t=n[e];if(void 0!==t)return t.exports;var a=n[e]={exports:{}};return r[e](a,a.exports,o),a.exports}o.m=r,o.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return o.d(t,{a:t}),t},o.d=(e,t)=>{for(var r in t)o.o(t,r)&&!o.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},o.f={},o.e=e=>Promise.all(Object.keys(o.f).reduce(((t,r)=>(o.f[r](e,t),t)),[])),o.u=e=>e+".js?ver=1747395727611",o.miniCssF=e=>e+".css",o.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),o.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),e={},t="content-restriction:",o.l=(r,n,a,i)=>{if(e[r])e[r].push(n);else{var l,c;if(void 0!==a)for(var s=document.getElementsByTagName("script"),d=0;d<s.length;d++){var u=s[d];if(u.getAttribute("src")==r||u.getAttribute("data-webpack")==t+a){l=u;break}}l||(c=!0,(l=document.createElement("script")).charset="utf-8",l.timeout=120,o.nc&&l.setAttribute("nonce",o.nc),l.setAttribute("data-webpack",t+a),l.src=r),e[r]=[n];var p=(t,n)=>{l.onerror=l.onload=null,clearTimeout(m);var o=e[r];if(delete e[r],l.parentNode&&l.parentNode.removeChild(l),o&&o.forEach((e=>e(n))),t)return t(n)},m=setTimeout(p.bind(null,void 0,{type:"timeout",target:l}),12e4);l.onerror=p.bind(null,l.onerror),l.onload=p.bind(null,l.onload),c&&document.head.appendChild(l)}},o.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},(()=>{var e;o.g.importScripts&&(e=o.g.location+"");var t=o.g.document;if(!e&&t&&(t.currentScript&&"SCRIPT"===t.currentScript.tagName.toUpperCase()&&(e=t.currentScript.src),!e)){var r=t.getElementsByTagName("script");if(r.length)for(var n=r.length-1;n>-1&&(!e||!/^http(s?):/.test(e));)e=r[n--].src}if(!e)throw new Error("Automatic publicPath is not supported in this browser");e=e.replace(/^blob:/,"").replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),o.p=e})(),(()=>{if("undefined"!=typeof document){var e={699:0};o.f.miniCss=(t,r)=>{e[t]?r.push(e[t]):0!==e[t]&&{704:1}[t]&&r.push(e[t]=(e=>new Promise(((t,r)=>{var n=o.miniCssF(e),a=o.p+n;if(((e,t)=>{for(var r=document.getElementsByTagName("link"),n=0;n<r.length;n++){var o=(i=r[n]).getAttribute("data-href")||i.getAttribute("href");if("stylesheet"===i.rel&&(o===e||o===t))return i}var a=document.getElementsByTagName("style");for(n=0;n<a.length;n++){var i;if((o=(i=a[n]).getAttribute("data-href"))===e||o===t)return i}})(n,a))return t();((e,t,r,n,a)=>{var i=document.createElement("link");i.rel="stylesheet",i.type="text/css",o.nc&&(i.nonce=o.nc),i.onerror=i.onload=r=>{if(i.onerror=i.onload=null,"load"===r.type)n();else{var o=r&&r.type,l=r&&r.target&&r.target.href||t,c=new Error("Loading CSS chunk "+e+" failed.\n("+o+": "+l+")");c.name="ChunkLoadError",c.code="CSS_CHUNK_LOAD_FAILED",c.type=o,c.request=l,i.parentNode&&i.parentNode.removeChild(i),a(c)}},i.href=t,document.head.appendChild(i)})(e,a,0,t,r)})))(t).then((()=>{e[t]=0}),(r=>{throw delete e[t],r})))}}})(),(()=>{var e={699:0};o.f.j=(t,r)=>{var n=o.o(e,t)?e[t]:void 0;if(0!==n)if(n)r.push(n[2]);else{var a=new Promise(((r,o)=>n=e[t]=[r,o]));r.push(n[2]=a);var i=o.p+o.u(t),l=new Error;o.l(i,(r=>{if(o.o(e,t)&&(0!==(n=e[t])&&(e[t]=void 0),n)){var a=r&&("load"===r.type?"missing":r.type),i=r&&r.target&&r.target.src;l.message="Loading chunk "+t+" failed.\n("+a+": "+i+")",l.name="ChunkLoadError",l.type=a,l.request=i,n[1](l)}}),"chunk-"+t,t)}};var t=(t,r)=>{var n,a,[i,l,c]=r,s=0;if(i.some((t=>0!==e[t]))){for(n in l)o.o(l,n)&&(o.m[n]=l[n]);c&&c(o)}for(t&&t(r);s<i.length;s++)a=i[s],o.o(e,a)&&e[a]&&e[a][0](),e[a]=0},r=globalThis.webpackChunkcontent_restriction=globalThis.webpackChunkcontent_restriction||[];r.forEach(t.bind(null,0)),r.push=t.bind(null,r.push.bind(r))})();var a=o(1609),i=o(6087),l=o(7723);const c=()=>(0,a.createElement)("div",{className:"content-restriction__preloader"},(0,l.__)("Content Restriction Dashboard Loading...","content-restriction")),s=(0,i.lazy)((()=>Promise.all([o.e(493),o.e(704)]).then(o.bind(o,6704))));document.addEventListener("DOMContentLoaded",(function(){const e=document.getElementById("content-restriction-admin-dashboard-app");e&&function(e){i.createRoot?(0,i.createRoot)(e).render((0,a.createElement)("div",{class:"content-restriction"},(0,a.createElement)(i.Suspense,{fallback:(0,a.createElement)(c,null)},(0,a.createElement)(s,null)))):render((0,a.createElement)("div",{class:"content-restriction"},(0,a.createElement)(i.Suspense,{fallback:(0,a.createElement)(c,null)},(0,a.createElement)(s,null))),e)}(e)}))})();
  • content-restriction/tags/1.4.0/config.php

    r3199191 r3294741  
    44
    55return [
    6     'version'     => '1.3.2',
     6    'version'     => '1.4.0',
    77    'min_php'     => '7.4',
    88    'db_version'  => '1.0.0',
  • content-restriction/tags/1.4.0/content-restriction.php

    r3199191 r3294741  
    66 * Plugin URI: https://wordpress.org/plugins/content-restriction/
    77 * Description: Content Restriction - A simple and user-friendly plugin to restrict users / visitors from viewing posts by restricting access, as simple as that.
    8  * Version: 1.3.2
     8 * Version: 1.4.0
    99 * Author: ContentRestriction.com
    1010 * Author URI: https://contentrestriction.com/?utm_source=wp-plugins&utm_campaign=author-uri&utm_medium=wp-dash
  • content-restriction/tags/1.4.0/languages/content-restriction.pot

    r3199191 r3294741  
    1 # Copyright (C) 2024 ContentRestriction.com
     1# Copyright (C) 2025 ContentRestriction.com
    22# This file is distributed under the GPLv2 or later.
    33msgid ""
    44msgstr ""
    5 "Project-Id-Version: All-in-One Content Restriction 1.3.2\n"
     5"Project-Id-Version: All-in-One Content Restriction 1.4.0\n"
    66"Report-Msgid-Bugs-To: "
    77"https://wordpress.org/support/plugin/content-restriction\n"
    8 "POT-Creation-Date: 2024-11-29 03:03:34+00:00\n"
     8"POT-Creation-Date: 2025-05-16 11:42:26+00:00\n"
    99"MIME-Version: 1.0\n"
    1010"Content-Type: text/plain; charset=utf-8\n"
    1111"Content-Transfer-Encoding: 8bit\n"
    12 "PO-Revision-Date: 2024-MO-DA HO:MI+ZONE\n"
     12"PO-Revision-Date: 2025-MO-DA HO:MI+ZONE\n"
    1313"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
    1414"Language-Team: LANGUAGE <LL@li.org>\n"
     
    111111#: app/Integrations/EasyDigitalDownloads/Frontend.php:65
    112112#: app/Integrations/WooCommerce/Frontend.php:67
    113 #: app/Modules/Posts/Frontend.php:49
     113#: app/Modules/Posts/Frontend.php:52
    114114msgid "Select Categories"
    115115msgstr ""
     
    345345msgstr ""
    346346
    347 #: app/Modules/Blur/Frontend.php:26 app/Modules/Randomize/Frontend.php:25
     347#: app/Modules/Blur/Frontend.php:27 app/Modules/Randomize/Frontend.php:26
    348348msgid "Apply To"
    349349msgstr ""
    350350
    351 #: app/Modules/Blur/Frontend.php:29 app/Modules/Randomize/Frontend.php:28
    352 #: app/Modules/Replace/Frontend.php:27
     351#: app/Modules/Blur/Frontend.php:30 app/Modules/Randomize/Frontend.php:29
     352#: app/Modules/Replace/Frontend.php:28
    353353msgid "Title"
    354354msgstr ""
    355355
    356 #: app/Modules/Blur/Frontend.php:30 app/Modules/Randomize/Frontend.php:29
    357 #: app/Modules/Replace/Frontend.php:32
     356#: app/Modules/Blur/Frontend.php:31 app/Modules/Randomize/Frontend.php:30
     357#: app/Modules/Replace/Frontend.php:33
    358358msgid "Content"
    359359msgstr ""
    360360
    361 #: app/Modules/Blur/Frontend.php:31 app/Modules/Randomize/Frontend.php:30
    362 #: app/Modules/Replace/Frontend.php:37
     361#: app/Modules/Blur/Frontend.php:32 app/Modules/Randomize/Frontend.php:31
     362#: app/Modules/Replace/Frontend.php:38
    363363msgid "Excerpt"
    364364msgstr ""
    365365
    366 #: app/Modules/Blur/Frontend.php:35
     366#: app/Modules/Blur/Frontend.php:36
    367367msgid "Level"
    368368msgstr ""
    369369
    370 #: app/Modules/Blur/Frontend.php:40
     370#: app/Modules/Blur/Frontend.php:41
    371371msgid "Spread"
    372372msgstr ""
     
    396396msgstr ""
    397397
    398 #: app/Modules/Pages/Frontend.php:27
     398#: app/Modules/Pages/Frontend.php:28
    399399msgid "Specific Page"
    400400msgstr ""
    401401
    402 #: app/Modules/Pages/Frontend.php:30
     402#: app/Modules/Pages/Frontend.php:31
    403403msgid "Specific page will be accessible when the set rule is applied."
    404404msgstr ""
    405405
    406 #: app/Modules/Pages/Frontend.php:34
     406#: app/Modules/Pages/Frontend.php:36
    407407msgid "Selected Pages"
    408408msgstr ""
    409409
    410 #: app/Modules/Pages/Frontend.php:42
     410#: app/Modules/Pages/Frontend.php:44
    411411msgid "Frontpage"
    412412msgstr ""
    413413
    414 #: app/Modules/Pages/Frontend.php:45
     414#: app/Modules/Pages/Frontend.php:47
    415415msgid "Frontpage will be accessible when the set rule is applied."
    416416msgstr ""
     
    424424msgstr ""
    425425
    426 #: app/Modules/Posts/Frontend.php:27
     426#: app/Modules/Posts/Frontend.php:28
    427427msgid "Specific Post"
    428428msgstr ""
    429429
    430 #: app/Modules/Posts/Frontend.php:30
     430#: app/Modules/Posts/Frontend.php:31
    431431msgid "Specific post will be accessible when the set rule is applied."
    432432msgstr ""
    433433
    434 #: app/Modules/Posts/Frontend.php:34
     434#: app/Modules/Posts/Frontend.php:36
    435435msgid "Select Posts"
    436436msgstr ""
    437437
    438 #: app/Modules/Posts/Frontend.php:42
     438#: app/Modules/Posts/Frontend.php:44
    439439msgid "Posts With Categories"
    440440msgstr ""
    441441
    442 #: app/Modules/Posts/Frontend.php:45
     442#: app/Modules/Posts/Frontend.php:47
    443443msgid "Post with the category will be accessible when the set rule is applied."
    444444msgstr ""
    445445
    446 #: app/Modules/Posts/Frontend.php:57
     446#: app/Modules/Posts/Frontend.php:60
    447447msgid "Posts With Tags"
    448448msgstr ""
    449449
    450 #: app/Modules/Posts/Frontend.php:60
     450#: app/Modules/Posts/Frontend.php:63
    451451msgid "Post with the tag will be accessible when the set rule is applied."
    452452msgstr ""
    453453
    454 #: app/Modules/Posts/Frontend.php:64
     454#: app/Modules/Posts/Frontend.php:68
    455455msgid "Select Tags"
    456456msgstr ""
     
    472472msgstr ""
    473473
    474 #: app/Modules/Redirection/Frontend.php:27
     474#: app/Modules/Redirection/Frontend.php:28
    475475msgid "Redirection to"
    476476msgstr ""
    477477
    478 #: app/Modules/Redirection/Frontend.php:28 app/Modules/Replace/Frontend.php:28
     478#: app/Modules/Redirection/Frontend.php:29 app/Modules/Replace/Frontend.php:29
    479479msgid "Title is a plugin that allows you to blur content on your site."
    480480msgstr ""
     
    488488msgstr ""
    489489
    490 #: app/Modules/Replace/Frontend.php:33
     490#: app/Modules/Replace/Frontend.php:34
    491491msgid "Randomize is a plugin that allows you to blur content on your site."
    492492msgstr ""
    493493
    494 #: app/Modules/Replace/Frontend.php:38
     494#: app/Modules/Replace/Frontend.php:39
    495495msgid "Excerpt is a plugin that allows you to blur content on your site."
     496msgstr ""
     497
     498#: app/Modules/Shortcode/Frontend.php:26
     499msgid "Shortcode"
     500msgstr ""
     501
     502#: app/Modules/Shortcode/Frontend.php:29
     503msgid "All the shortcode area will be accessible when the set rule is applied."
    496504msgstr ""
    497505
     
    501509
    502510#: app/Modules/WordPressUsers/Frontend.php:24
    503 #: app/Modules/WordPressUsers/Frontend.php:40
     511#: app/Modules/WordPressUsers/Frontend.php:41
    504512msgid "Select who should have access to the content."
    505513msgstr ""
    506514
    507 #: app/Modules/WordPressUsers/Frontend.php:28
     515#: app/Modules/WordPressUsers/Frontend.php:29
    508516msgid "Select Roles"
    509517msgstr ""
    510518
    511 #: app/Modules/WordPressUsers/Frontend.php:36
     519#: app/Modules/WordPressUsers/Frontend.php:37
    512520msgid "User Name"
    513521msgstr ""
    514522
    515 #: app/Modules/WordPressUsers/Frontend.php:44
     523#: app/Modules/WordPressUsers/Frontend.php:46
    516524msgid "Select Users"
    517525msgstr ""
    518526
    519 #: app/Modules/WordPressUsers/Frontend.php:52
     527#: app/Modules/WordPressUsers/Frontend.php:54
    520528msgid "Logged In User"
    521529msgstr ""
    522530
    523 #: app/Modules/WordPressUsers/Frontend.php:55
     531#: app/Modules/WordPressUsers/Frontend.php:57
    524532msgid "Only logged in user should have access to the content."
    525533msgstr ""
    526534
    527 #: app/Modules/WordPressUsers/Frontend.php:59
     535#: app/Modules/WordPressUsers/Frontend.php:62
    528536msgid "Logged Out User"
    529537msgstr ""
    530538
    531 #: app/Modules/WordPressUsers/Frontend.php:62
     539#: app/Modules/WordPressUsers/Frontend.php:65
    532540msgid "Only logged out user should have access to the content."
    533541msgstr ""
  • content-restriction/tags/1.4.0/readme.txt

    r3199191 r3294741  
    11=== All-in-One Content Restriction – Conditional Content Visibility & Access Control for WordPress ===
    2 Contributors: Pluginly, HeyMehedi
    3 Tags: content restriction, access control, private, permission, restrict access
     2Contributors: pluginly, heymehedi
     3Tags: content restriction, restrict access, user permissions, conditional content, membership
    44Requires at least: 5.6
    5 Tested up to: 6.6.2
     5Tested up to: 6.8
    66Requires PHP: 7.4
    7 Stable tag: 1.3.2
     7Stable tag: 1.4.0
    88License: GPLv2 or later
    99License URI: https://www.gnu.org/licenses/gpl-2.0.html
    1010
    11 All-in-One Content Restriction is a comprehensive, easy to use & feature-packed WordPress content restriction plugin.
     11Take control of your content. Restrict any post, page, or custom content based on user roles, login state, or custom rules. No code needed.
    1212
    1313== Description ==
    14 All-in-One Content Restriction is a comprehensive, easy to use & feature-packed WordPress content restriction plugin to set content access rules for any user - whether logged in, holding specific user role, or a visitor.
    1514
    16 Decide who gets to see what content – be it pages, posts , taxonomy or any custom post type by setting up content visibility rules.
     15**Who sees what? You decide.**
    1716
    18 You can transform any static content into conditional and personalized content.
     17All-in-One Content Restriction is the ultimate WordPress plugin for managing who can access which parts of your site – posts, pages, taxonomies, custom post types, you name it.
    1918
    20 Unlock all features with [Content Restriction Pro](https://contentrestriction.com/?utm_source=wp-plugins&utm_campaign=author-uri&utm_medium=wp-dash).
     19Whether you're building a members-only area, hiding content from guests, or creating a personalized experience for logged-in users — this plugin lets you define visibility rules in a few clicks.
    2120
    22 = Restrict any content in seconds!⏱️ =
    23 This plugin is intently built with the non-technical users in mind.You have complete control over who can access your website's content and how it is protected.
     21🏆 Perfect for:
     22- Membership sites
     23- Online courses
     24- Premium content gating
     25- Multi-role intranets
     26- Custom user journeys
    2427
    25 It just takes **3 simple steps**:
     28> Want even more power? Unlock premium features with [Content Restriction Pro](https://contentrestriction.com/?utm_source=wp-plugins&utm_campaign=author-uri&utm_medium=wp-dash).
    2629
    27 1️⃣ **Set rules for content visibility:** Determine who can view the content
     30---
    2831
    29 2️⃣ **Unlock content based on permissions:** Specify what content will be accessible if a user meets the visibility criteria.
     32== 🚀 Features at a Glance ==
    3033
    31 3️⃣ **Protect content for unauthorized users:** Decide how the content should be restricted for users who do not meet the access permissions.
     34**🔐 Restriction Logic**
     35- Show/hide content based on:
     36  - Logged-in status
     37  - User roles
     38  - Specific usernames
     39  - Guest visitors
    3240
    33 = Features Spotlight =
     41**🧱 Content Coverage**
     42- Posts (individual or category/tag-based)
     43- Pages (including homepage)
     44- Custom post types
     45- Any taxonomy
    3446
    35 == Content Types ==
     47**🛑 Restriction Methods**
     48Choose what happens *when access is denied*:
     49- **Replace:** Swap content with a custom message
     50- **Hide:** Make it vanish completely
     51- **Login & Return:** Prompt login, then redirect back
     52- **Redirect:** Send users to another page (custom or predefined)
     53- **Blur:** Apply visual blur to titles, excerpts, or content
     54- **Obfuscate:** Garble text to hide meaning
    3655
    37 **Post**
    38 🔹 Restrict access to all posts.
    39 🔹 Restrict access to specific posts.
    40 🔹 Restrict access to posts in a specific category.
    41 🔹 Restrict access to posts with a specific tag.
     56---
    4257
    43 **Page**
    44 🔹 Restrict access to the homepage / front page.
    45 🔹 Restrict access to all pages.
    46 🔹 Restrict access to specific pages.
     58== 🎯 Built for Everyone ==
    4759
     60**Non-techies** can restrict content in seconds — no coding, no confusion.
    4861
    49 **Custom Content**
    50 Restrict access to any taxonomy & custom post type (CPT)
     62**Developers** get hooks, filters, and tight integration with popular plugins. Scale it however you like.
    5163
    52 == User Types ==
    53 🔹 Logged-in user
    54 🔹 Logged-out user
    55 🔹 User role
    56 🔹 Specific username
     64---
    5765
    58 == Restriction Types ==
    59 When a user does not have access permission, the following rules can be applied to control their experience:
     66== 📦 Integrations (Native Support) ==
    6067
    61 🔹 Replace: Replace the post or page title, excerpt, and description with a custom message.
    62 🔹 Hide: Hide the post or page entirely.
    63 🔹 Login & Return: Redirect the user back to the current post or page after they log in.
    64 🔹 Redirect: Redirect the post or page to the homepage, blog page, or a custom URL.
    65 🔹 Blur: Blur the post or page title, excerpt, and description.
    66 🔹 Obfuscate: Randomize words in the post or page title, excerpt, and description.
     68✅ WooCommerce 
     69✅ Easy Digital Downloads 
     70✅ FluentCRM 
     71✅ Directorist 
     72✅ Login Me Now 
    6773
     74🛠 Coming soon:
     75- ACF (Advanced Custom Fields)
     76- Elementor
     77- BuddyPress
     78- BuddyBoss
     79- Tutor LMS
     80- LearnDash
    6881
    69 == Direct Integrations ==
    70 🔹 WooCommerce
    71 🔹 Easy Digital Downloads
    72 🔹 FluentCRM
    73 🔹 Directorist
    74 🔹 Login Me Now
    75 🔹 ACF - Advanced Custom Fields (Upcoming)
    76 🔹 BuddyPress (Upcoming)
    77 🔹 BuddyBoss (Upcoming)
    78 🔹 Elementor (Upcoming)
    79 🔹 TutorLMS (Upcoming)
    80 🔹 Learndash (Upcoming)
     82---
    8183
     84== 🧩 Other Plugins by Us ==
    8285
    83 = OTHER AMAZING PLUGIN BY US =
    84 [Login Me Now](https://wordpress.org/plugins/login-me-now/)
     86🔥 [Login Me Now](https://wordpress.org/plugins/login-me-now/) — Passwordless login, user switching, email magic links, and more.
    8587
    86 = FIND AN ISSUE? =
     88---
    8789
    88 We are right here to help you in [support forum](https://wordpress.org/support/plugin/content-restriction/). You can post a topic. Please search existing topics before starting a new one.
     90== 📥 Installation ==
    8991
     921. Upload the plugin files to `/wp-content/plugins/content-restriction`, or install via the WordPress Plugin Directory.
     932. Activate the plugin through the "Plugins" screen in WordPress.
     943. Start setting rules under the "Content Restriction" menu.
    9095
    91 == Installation ==
    92 Install Content Restriction either via the WordPress.org plugin repository or by uploading the files to your server.
     96---
    9397
    9498== Frequently Asked Questions ==
    9599
    96 = Will content restriction work with my theme? =
    97 Yes! This plugin works with most theme out-of-the-box. However some themes may need adjustments due to not using WordPress/WooCommerce standard hooks or styles or if they add their own customizations which might conflict with Content Restriction.
     100= Will it work with my theme? = 
     101Yes, Content Restriction works with most well-coded WordPress themes. If something looks off, hit us up in the [support forum](https://wordpress.org/support/plugin/content-restriction/) — we’re on it.
    98102
    99 **If you have any issues using Content Restriction with your theme please let us know through the [support forum](https://wordpress.org/support/plugin/content-restriction/) and we’ll fix it asap.**
     103= Does it protect media files like images or videos? = 
     104It restricts the *display* of embedded media in posts/pages, but direct media URLs can still be accessed unless protected via server-level rules.
    100105
    101 = Is content restriction  compliant with privacy laws (GDPR / RGPD / CCPA / LGPD)? =
    102 We value your privacy and your customers’ privacy.
     106= Is it privacy-compliant (GDPR / CCPA / etc.)? = 
     107We do not collect any personal data or track users. You’re in full control. If we ever request anonymous usage data, you’ll have the option to opt in.
    103108
    104 While we cannot guarantee that the plugin is fully compliant with privacy laws in every country.
     109= Do I need to create an account? = 
     110Nope. Everything lives securely in your WordPress dashboard. No 3rd-party accounts or logins needed.
    105111
    106 **We assure you that Fluid Checkout does not, and will not, collect any customer data from your shop.**
     112---
    107113
    108 In the future, **and with your explicit consent**, we might collect some non-sensitive usage data from your website such as the plugin and WooCommerce settings, which other plugins and themes you have installed on your shop to help us to improve the plugin stability.
     114== 🛠 Need Help? ==
    109115
    110 Details and examples of the data collected will be shown on the plugin interface for you to review prior to sending the data to our servers for collection and storage.
     116We monitor the [support forum](https://wordpress.org/support/plugin/content-restriction/) actively — drop your questions there. Please search before creating a new topic to avoid duplicates.
    111117
    112 = Does the plugin protect images, videos and other media files? =
    113 Yes. Content Restriction can restrict access to media that is embedded within a post or page, but it does not protect the original file URL on the server.
     118---
    114119
    115 = Do I need to create a account to use the plugin? =
    116 No you don’t have to create account to use this plugin. Gated content rules setup & membership data live securely within the central WordPress dashboard of your website.
     120== 🧾 Changelog ==
    117121
    118 
    119 == Changelog ==
    120 
     122= 1.4.0 – May 16, 2024 =
     123* New: Shortcode Module
    121124
    122125= 1.3.2 – Nov 29, 2024 =
    123 * Fix: Translation Warning Issue   
     126* Fix: Translation Warning Issue
    124127
    125128= 1.3.1 – Nov 26, 2024 =
    126 * Add: Hook - content_restriction_module_condition_check_before
     129* Add: Hook - `content_restriction_module_condition_check_before`
    127130
    128131= 1.3.0 – Nov 4, 2024 =
    129 * New: Integrations Page Added
    130 * Improve: Add User Consent
    131 * Improve: Changed Default Status
    132 * Announce: PRO Released
     132* New: Integrations Page
     133* Improve: User Consent UI
     134* Improve: Default Visibility Behavior
     135* Launch: PRO Version Announcement
    133136
    134137= 1.2.2 – Sep 21, 2024 =
    135 * Fix: Login & Back Dashboard Error
     138* Fix: Login & Dashboard Return Bug
    136139
    137140= 1.2.1 – Sep 19, 2024 =
    138 * Fix: Specific Post Hide Issue
    139 * Fix: Cache Issue for Dashboard
     141* Fix: Specific Post Visibility Issue
     142* Fix: Cache Conflict on Dashboard
    140143
    141144= 1.2.0 – Sep 7, 2024 =
    142145* Add: WooCommerce Subscription Integration
    143 * Fix: WooCommerce Error
     146* Fix: WooCommerce Display Issue
    144147
    145148= 1.1.1 – Aug 30, 2024 =
    146 * Fix: Hide Issue
     149* Fix: Content Hide Bug
    147150
    148151= 1.1.0 – Aug 27, 2024 =
    149 * Add: WooCommerce Integration
    150 * Add: Directorist Integration
    151 * Add: FluentCRM Integration
    152 * Add: Login Me Now Integration
    153 * Add: Easy Digital Downloads Integration
     152* Add: WooCommerce, Directorist, FluentCRM, Login Me Now, and EDD Integrations
    154153
    155154= 1.0.0 – Aug 18, 2024 =
  • content-restriction/tags/1.4.0/vendor/autoload.php

    r3137277 r3294741  
    1515        }
    1616    }
    17     trigger_error(
    18         $err,
    19         E_USER_ERROR
    20     );
     17    throw new RuntimeException($err);
    2118}
    2219
  • content-restriction/tags/1.4.0/vendor/composer/InstalledVersions.php

    r3137277 r3294741  
    2828{
    2929    /**
     30     * @var string|null if set (by reflection by Composer), this should be set to the path where this class is being copied to
     31     * @internal
     32     */
     33    private static $selfDir = null;
     34
     35    /**
    3036     * @var mixed[]|null
    3137     * @psalm-var array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>}|array{}|null
    3238     */
    3339    private static $installed;
     40
     41    /**
     42     * @var bool
     43     */
     44    private static $installedIsLocalDir;
    3445
    3546    /**
     
    310321        self::$installed = $data;
    311322        self::$installedByVendor = array();
     323
     324        // when using reload, we disable the duplicate protection to ensure that self::$installed data is
     325        // always returned, but we cannot know whether it comes from the installed.php in __DIR__ or not,
     326        // so we have to assume it does not, and that may result in duplicate data being returned when listing
     327        // all installed packages for example
     328        self::$installedIsLocalDir = false;
     329    }
     330
     331    /**
     332     * @return string
     333     */
     334    private static function getSelfDir()
     335    {
     336        if (self::$selfDir === null) {
     337            self::$selfDir = strtr(__DIR__, '\\', '/');
     338        }
     339
     340        return self::$selfDir;
    312341    }
    313342
     
    323352
    324353        $installed = array();
     354        $copiedLocalDir = false;
    325355
    326356        if (self::$canGetVendors) {
     357            $selfDir = self::getSelfDir();
    327358            foreach (ClassLoader::getRegisteredLoaders() as $vendorDir => $loader) {
     359                $vendorDir = strtr($vendorDir, '\\', '/');
    328360                if (isset(self::$installedByVendor[$vendorDir])) {
    329361                    $installed[] = self::$installedByVendor[$vendorDir];
     
    331363                    /** @var array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>} $required */
    332364                    $required = require $vendorDir.'/composer/installed.php';
    333                     $installed[] = self::$installedByVendor[$vendorDir] = $required;
    334                     if (null === self::$installed && strtr($vendorDir.'/composer', '\\', '/') === strtr(__DIR__, '\\', '/')) {
    335                         self::$installed = $installed[count($installed) - 1];
     365                    self::$installedByVendor[$vendorDir] = $required;
     366                    $installed[] = $required;
     367                    if (self::$installed === null && $vendorDir.'/composer' === $selfDir) {
     368                        self::$installed = $required;
     369                        self::$installedIsLocalDir = true;
    336370                    }
     371                }
     372                if (self::$installedIsLocalDir && $vendorDir.'/composer' === $selfDir) {
     373                    $copiedLocalDir = true;
    337374                }
    338375            }
     
    351388        }
    352389
    353         if (self::$installed !== array()) {
     390        if (self::$installed !== array() && !$copiedLocalDir) {
    354391            $installed[] = self::$installed;
    355392        }
  • content-restriction/tags/1.4.0/vendor/composer/installed.php

    r3199191 r3294741  
    22    'root' => array(
    33        'name' => 'pluginly/content-restriction',
    4         'pretty_version' => '1.3.2',
    5         'version' => '1.3.2.0',
    6         'reference' => '2a472ba24ef373bc73c01573d5c5bd283ee44465',
     4        'pretty_version' => '1.4.0',
     5        'version' => '1.4.0.0',
     6        'reference' => 'bf4db08d4d0efa497dbfbfb2d7b71b1c2952bfe1',
    77        'type' => 'library',
    88        'install_path' => __DIR__ . '/../../',
     
    1212    'versions' => array(
    1313        'pluginly/content-restriction' => array(
    14             'pretty_version' => '1.3.2',
    15             'version' => '1.3.2.0',
    16             'reference' => '2a472ba24ef373bc73c01573d5c5bd283ee44465',
     14            'pretty_version' => '1.4.0',
     15            'version' => '1.4.0.0',
     16            'reference' => 'bf4db08d4d0efa497dbfbfb2d7b71b1c2952bfe1',
    1717            'type' => 'library',
    1818            'install_path' => __DIR__ . '/../../',
  • content-restriction/trunk/app/Admin/Controllers/ModuleController.php

    r3196884 r3294741  
    2222
    2323    public function restrict_view( \WP_REST_Request $request ): array {
    24         $modules = apply_filters( 'content_restriction_restrict_view_module_list', [] );
     24        $modules = apply_filters( 'content_restriction_restrict_view_module_list', [], $request );
    2525
    2626        return $this->filter( $request, $modules );
    2727    }
    2828
     29    /**
     30     * Register Groups for Modules
     31     */
    2932    public function groups(): array {
    3033        return apply_filters( 'content_restriction_module_group_list', [] );
    3134    }
    3235
     36    /**
     37     * Before Sending Response Filter All The Modules
     38     * To Ensure That The Admin Frontend Showing Correct Result
     39     */
    3340    private function filter( \WP_REST_Request $request, array $modules ): array {
    3441        $filter_keys = ['what_content', 'who_can_see', 'restrict_view'];
     
    3643        foreach ( $modules as $key => $module ) {
    3744
     45            /**
     46             * Add selected key to the module
     47             */
    3848            foreach ( $filter_keys as $filter_key ) {
    3949                $param_value = $request->get_param( $filter_key );
     
    4858            $modules[$key] = apply_filters( 'content_restriction_module_condition_check_before', $module, $request );
    4959
    50             if ( ! isset( $module['conditions'] ) ) {
     60            /**
     61             * If the module has no conditions, don't run remaining code.
     62             */
     63            if ( ! isset( $modules[$key]['conditions'] ) ) {
    5164                continue;
    5265            }
    5366
     67            /**
     68             * Check if the current module meets the conditions.
     69             */
    5470            foreach ( $filter_keys as $filter_key ) {
    5571                $param_value      = $request->get_param( $filter_key );
  • content-restriction/trunk/app/Admin/Routes/RulesRoute.php

    r3137277 r3294741  
    1717        $this->post( $this->endpoint . '/update', [\ContentRestriction\Admin\Controllers\RuleController::class, 'update'] );
    1818        $this->post( $this->endpoint . '/delete', [\ContentRestriction\Admin\Controllers\RuleController::class, 'delete'] );
     19       
    1920        $this->post( $this->endpoint . '/list', [\ContentRestriction\Admin\Controllers\RuleController::class, 'list'] );
    2021    }
  • content-restriction/trunk/app/Boot/App.php

    r3142420 r3294741  
    3838        ( new \ContentRestriction\Providers\AdminServiceProviders() )->boot();
    3939        ( new \ContentRestriction\Providers\FrontendServiceProviders() )->boot();
     40        ( new \ContentRestriction\Modules\Shortcode\ServiceProvider )->boot();
    4041        ( new \ContentRestriction\Providers\IntegrationServiceProviders() )->boot();
    4142        ( new \ContentRestriction\Providers\RestrictionServiceProviders )->boot();
  • content-restriction/trunk/app/Models/RuleModel.php

    r3137277 r3294741  
    7878        );
    7979    }
     80
     81    public function get( $id ) {
     82        $query = $this->wpdb->prepare(
     83            "SELECT * FROM {$this->table} WHERE id = %d",
     84            $id
     85        );
     86
     87        $result = $this->wpdb->get_row( $query, ARRAY_A );
     88
     89        return $result;
     90    }
    8091}
  • content-restriction/trunk/app/Modules/Blur/Blur.php

    r3137277 r3294741  
    88namespace ContentRestriction\Modules\Blur;
    99
     10use ContentRestriction\Utils\Random;
     11
    1012class Blur extends \ContentRestriction\Common\RestrictViewBase {
    1113
     
    1618        $this->who_can_see  = $who_can_see;
    1719        $this->what_content = $what_content;
    18         $this->options      = $this->rule['rule'][$this->type][$this->module] ?? [];
    19         $this->protection   = new Protection( $what_content, $this->options, $this->rule );
     20        $this->options      = $rule['rule'][$this->type][$this->module] ?? [];
    2021    }
    2122
     23    /**
     24     * Initializes blur protection on restricted content if access is denied.
     25     */
    2226    public function boot(): void {
    23         $if = ( new $this->who_can_see( $this->rule ) );
    24         if ( $if->has_access() ) {
     27        /**
     28         * Allow developers to intervene before applying content blur,
     29         * using the 'content_restriction_blur_before' filter. If any
     30         * callback returns false, stop further processing.
     31         *
     32         * @param bool  $continue Whether to proceed with content blur.
     33         * @param self  $this     Current instance of the restriction handler.
     34         */
     35        if ( ! apply_filters( 'content_restriction_blur_before', true, $this ) ) {
    2536            return;
    2637        }
    2738
    28         add_filter( 'content_restriction_the_title', [$this, 'the_title'], 10 );
    29         add_filter( 'content_restriction_the_excerpt', [$this, 'the_excerpt'], 1 );
    30         add_filter( 'content_restriction_the_content', [$this, 'the_content'] );
     39        $who_can_see = new $this->who_can_see( $this->rule );
     40        if ( $who_can_see->has_access() ) {
     41            return;
     42        }
     43
     44        // Hook into all three filters
     45        add_filter( 'content_restriction_the_title', [$this, 'modify_content'], 10 );
     46        add_filter( 'content_restriction_the_excerpt', [$this, 'modify_content'], 1 );
     47        add_filter( 'content_restriction_the_content', [$this, 'modify_content'] );
    3148    }
    3249
    33     public function the_title( $title ) {
    34         \ContentRestriction\Utils\Analytics::add( [
    35             'user_id' => get_current_user_id(),
    36             'post_id' => get_the_ID(),
    37             'context' => 'locked',
    38             'id'      => $this->rule['id'],
    39         ] );
    40 
    41         $this->protection->set_post_id( get_the_ID() );
    42 
    43         if ( $this->apply_to( 'title' ) ) {
    44             $title = $this->protection->add( $title );
     50    /**
     51     * Applies blur protection to title, excerpt, or content based on settings.
     52     */
     53    public function modify_content( $content, $type = '' ): string {
     54        switch ( current_filter() ) {
     55            case 'content_restriction_the_title':
     56                $type = 'title';
     57                break;
     58            case 'content_restriction_the_excerpt':
     59                $type = 'excerpt';
     60                break;
     61            case 'content_restriction_the_content':
     62                $type = 'content';
     63                break;
    4564        }
    4665
    47         return $title;
     66        if ( ! $type || ! $this->should_apply( $type ) ) {
     67            return $content;
     68        }
     69
     70        $this->post_id = get_the_ID();
     71
     72        return $this->add_protection( $content );
    4873    }
    4974
    50     public function the_excerpt( $excerpt ) {
    51         if ( $this->apply_to( 'excerpt' ) ) {
    52             $excerpt = $this->protection->add( $excerpt );
     75    public function add_protection( $content ) {
     76        if ( ! $this->is_allowed() ) {
     77            return $content;
    5378        }
    5479
    55         return $excerpt;
     80        $html_tag      = 'div';
     81        $add_rand_text = apply_filters( 'content_restriction_blur_protection_rand_text', true );
     82        if ( $add_rand_text ) {
     83            $content = Random::randomize( $content );
     84        }
     85
     86        $blur_level = $this->options['level'] ?? 10;
     87        $spread     = $this->options['spread'] ?? 10;
     88
     89        return sprintf(
     90            '<%s class="aiocr-blur" style="-webkit-filter: blur(%spx); text-shadow: 0 0 %spx #000;">%s</%s>',
     91            $html_tag,
     92            esc_attr( $blur_level ),
     93            esc_attr( $spread ),
     94            $content,
     95            $html_tag
     96        );
    5697    }
    5798
    58     public function the_content( $content ) {
    59         if ( $this->apply_to( 'content' ) ) {
    60             $content = $this->protection->add( $content );
    61         }
    62 
    63         return $content;
    64     }
    65 
    66     private function apply_to( string $t ): bool {
    67         $arr = $this->options['apply_to'] ?? [];
    68         if ( in_array( $t, $arr ) ) {
     99    private function is_allowed(): bool {
     100        $what_content = new $this->what_content( $this->rule );
     101        $what_content->set_post_id( $this->post_id );
     102        if ( $what_content->protect() ) {
    69103            return true;
    70104        }
     
    72106        return false;
    73107    }
     108
     109    /**
     110     * Determines whether blur should be applied to a given content type.
     111     */
     112    private function should_apply( string $type ): bool {
     113        return in_array( $type, $this->options['apply_to'] ?? [], true );
     114    }
    74115}
  • content-restriction/trunk/app/Modules/Blur/Frontend.php

    r3137277 r3294741  
    2222            'desc'       => __( 'Blur title, excerpt and description.', 'content-restriction' ),
    2323            'type'       => 'section',
     24            'group'      => 'wordpress',
    2425            'options'    => [
    2526                'apply_to' => [
     
    5455                        'specific_pages',
    5556                        'frontpage',
     57                        'shortcode'
    5658                    ],
    5759                    'compare'      => 'has_any',
  • content-restriction/trunk/app/Modules/Hide/Frontend.php

    r3137277 r3294741  
    1818    public function list( array $modules ): array {
    1919        $modules[] = [
    20             'name' => __( 'Hide', 'content-restriction' ),
    21             'key'  => 'hide',
    22             'icon' => $this->get_icon( 'Hide' ),
    23             'desc' => __( 'Hide entirely.', 'content-restriction' ),
     20            'name'  => __( 'Hide', 'content-restriction' ),
     21            'key'   => 'hide',
     22            'icon'  => $this->get_icon( 'Hide' ),
     23            'desc'  => __( 'Hide entirely.', 'content-restriction' ),
     24            'group' => 'wordpress',
    2425        ];
    2526
  • content-restriction/trunk/app/Modules/LoginBack/Frontend.php

    r3144029 r3294741  
    2222            'icon'       => $this->get_icon( 'LoginBack' ),
    2323            'desc'       => __( 'Redirect back to the current post or page after the user logged in.', 'content-restriction' ),
     24            'group'      => 'wordpress',
    2425            'conditions' => apply_filters(
    2526                'content_restriction_module_login_and_back_conditions',
  • content-restriction/trunk/app/Modules/Pages/Frontend.php

    r3137277 r3294741  
    1818    public function list( array $modules ): array {
    1919        $modules[] = [
    20             'name' => __( 'All Pages', 'content-restriction' ),
    21             'key'  => 'all_pages',
    22             'icon' => $this->get_icon( 'WordPress' ),
    23             'desc' => __( 'All the pages will be accessible when the set rule is applied.', 'content-restriction' ),
     20            'name'  => __( 'All Pages', 'content-restriction' ),
     21            'key'   => 'all_pages',
     22            'icon'  => $this->get_icon( 'WordPress' ),
     23            'desc'  => __( 'All the pages will be accessible when the set rule is applied.', 'content-restriction' ),
     24            'group' => 'wordpress',
    2425        ];
    2526
     
    3031            'desc'    => __( 'Specific page will be accessible when the set rule is applied.', 'content-restriction' ),
    3132            'type'    => 'section',
     33            'group'   => 'wordpress',
    3234            'options' => [
    3335                'pages' => [
     
    4042
    4143        $modules[] = [
    42             'name' => __( 'Frontpage', 'content-restriction' ),
    43             'key'  => 'frontpage',
    44             'icon' => $this->get_icon( 'WordPress' ),
    45             'desc' => __( 'Frontpage will be accessible when the set rule is applied.', 'content-restriction' ),
     44            'name'  => __( 'Frontpage', 'content-restriction' ),
     45            'key'   => 'frontpage',
     46            'icon'  => $this->get_icon( 'WordPress' ),
     47            'desc'  => __( 'Frontpage will be accessible when the set rule is applied.', 'content-restriction' ),
     48            'group' => 'wordpress',
    4649        ];
    4750
  • content-restriction/trunk/app/Modules/Posts/Frontend.php

    r3137277 r3294741  
    1818    public function list( array $modules ): array {
    1919        $modules[] = [
    20             'name' => __( 'All Posts', 'content-restriction' ),
    21             'key'  => 'all_posts',
    22             'icon' => $this->get_icon( 'WordPress' ),
    23             'desc' => __( 'All the posts will be accessible when the set rule is applied.', 'content-restriction' ),
     20            'name'  => __( 'All Posts', 'content-restriction' ),
     21            'key'   => 'all_posts',
     22            'icon'  => $this->get_icon( 'WordPress' ),
     23            'desc'  => __( 'All the posts will be accessible when the set rule is applied.', 'content-restriction' ),
     24            'group' => 'wordpress',
    2425        ];
    2526
     
    3031            'desc'    => __( 'Specific post will be accessible when the set rule is applied.', 'content-restriction' ),
    3132            'type'    => 'section',
     33            'group'   => 'wordpress',
    3234            'options' => [
    3335                'posts' => [
     
    4547            'desc'    => __( 'Post with the category will be accessible when the set rule is applied.', 'content-restriction' ),
    4648            'type'    => 'section',
     49            'group'   => 'wordpress',
    4750            'options' => [
    4851                'categories' => [
     
    6063            'desc'    => __( 'Post with the tag will be accessible when the set rule is applied.', 'content-restriction' ),
    6164            'type'    => 'section',
     65            'group'   => 'wordpress',
    6266            'options' => [
    6367                'tags' => [
  • content-restriction/trunk/app/Modules/Randomize/Frontend.php

    r3142420 r3294741  
    2121            'desc'       => __( 'Randomize words in the post or page title, excerpt, and description.', 'content-restriction' ),
    2222            'type'       => 'section',
     23            'group'      => 'wordpress',
    2324            'options'    => [
    2425                'apply_to' => [
     
    4142                    'specific_pages',
    4243                    'frontpage',
     44                    'shortcode'
    4345                ],
    4446                'compare'      => 'has_any',
  • content-restriction/trunk/app/Modules/Redirection/Frontend.php

    r3142420 r3294741  
    2323            'desc'    => __( 'Redirect to any URL.', 'content-restriction' ),
    2424            'type'    => 'section',
     25            'group'   => 'wordpress',
    2526            'options' => [
    2627                'url' => [
  • content-restriction/trunk/app/Modules/Replace/Frontend.php

    r3137277 r3294741  
    2323            'desc'       => __( 'Replace title, excerpt, and description with custom message.', 'content-restriction' ),
    2424            'type'       => 'section',
     25            'group'      => 'wordpress',
    2526            'options'    => [
    2627                'title'   => [
  • content-restriction/trunk/app/Modules/Replace/Replace.php

    r3137277 r3294741  
    88namespace ContentRestriction\Modules\Replace;
    99
     10use ContentRestriction\Utils\Analytics;
     11
    1012class Replace extends \ContentRestriction\Common\RestrictViewBase {
    1113
     
    1618        $this->who_can_see  = $who_can_see;
    1719        $this->what_content = $what_content;
    18         $this->options      = $this->rule['rule'][$this->type][$this->module] ?? [];
    19         $this->protection   = new Protection( $what_content, $this->options, $this->rule );
     20        $this->options      = $rule['rule'][$this->type][$this->module] ?? [];
    2021    }
    2122
     23    /**
     24     * Initializes content restriction checks and applies modifications as needed.
     25     */
    2226    public function boot(): void {
    23         $if = ( new $this->who_can_see( $this->rule ) );
    24         if ( $if->has_access() ) {
     27
     28        /**
     29         * Allow developers to intervene before applying content replacement,
     30         * using the 'content_restriction_replace_before' filter. If any
     31         * callback returns false, stop further processing.
     32         *
     33         * @param bool  $continue Whether to proceed with content replacement.
     34         * @param self  $this     Current instance of the restriction handler.
     35         */
     36        if ( ! apply_filters( 'content_restriction_replace_before', true, $this ) ) {
    2537            return;
    2638        }
    2739
    28         \ContentRestriction\Utils\Analytics::add( [
     40        // Exit early if the current user has access to the restricted content
     41        $who_can_see = new $this->who_can_see( $this->rule );
     42        if ( $who_can_see->has_access() ) {
     43            return;
     44        }
     45
     46        // Log that the user encountered restricted content
     47        Analytics::add( [
    2948            'user_id' => get_current_user_id(),
    3049            'context' => 'locked',
     
    3251        ] );
    3352
    34         add_filter( 'content_restriction_the_title', [$this, 'the_title'], 10 );
    35         add_filter( 'content_restriction_the_excerpt', [$this, 'the_excerpt'], 1 );
    36         add_filter( 'content_restriction_the_content', [$this, 'the_content'] );
     53        // Attach filters to modify restricted content areas as specified by the rule
     54        add_filter( 'content_restriction_the_title', [$this, 'modify_content'], 10 );
     55        add_filter( 'content_restriction_the_excerpt', [$this, 'modify_content'], 1 );
     56        add_filter( 'content_restriction_the_content', [$this, 'modify_content'], 10 );
    3757    }
    3858
    39     public function the_title( $title ) {
    40         $this->protection->set_post_id( get_the_ID() );
    41 
    42         $override = $this->apply_to( 'title' );
    43         if ( ! empty( $override ) ) {
    44             $title = $this->protection->add( $title, $override );
     59    public function modify_content( $content ): string {
     60        switch ( current_filter() ) {
     61            case 'content_restriction_the_title':
     62                $type = 'title';
     63                break;
     64            case 'content_restriction_the_excerpt':
     65                $type = 'excerpt';
     66                break;
     67            case 'content_restriction_the_content':
     68                $type = 'content';
     69                break;
    4570        }
    4671
    47         return $title;
     72        $this->post_id = get_the_ID() ?: 0;
     73        $override      = (string) $this->options[$type] ?? '';
     74
     75        return ! empty( $override ) ? $this->add_protection( $content, $override ) : $content;
    4876    }
    4977
    50     public function the_excerpt( $excerpt ) {
    51         $override = $this->apply_to( 'excerpt' );
    52         if ( $override ) {
    53             $excerpt = $this->protection->add( $excerpt, $override );
     78    private function add_protection( string $content, string $override ) {
     79        if ( ! $this->is_allowed() ) {
     80            return $content;
    5481        }
    5582
    56         return $excerpt;
     83        return $override;
    5784    }
    5885
    59     public function the_content( $content ) {
    60         $override = $this->apply_to( 'content' );
    61         if ( $override ) {
    62             $content = $this->protection->add( $content, $override );
     86    private function is_allowed(): bool {
     87        $what_content = new $this->what_content( $this->rule );
     88        $what_content->set_post_id( $this->post_id );
     89        if ( $what_content->protect() ) {
     90            return true;
    6391        }
    6492
    65         return $content;
    66     }
    67 
    68     private function apply_to( string $t ) {
    69         if ( isset( $this->options[$t] ) ) {
    70             return $this->options[$t];
    71         }
    72 
    73         return '';
     93        return false;
    7494    }
    7595}
  • content-restriction/trunk/app/Modules/WordPressUsers/Frontend.php

    r3137277 r3294741  
    2424            'desc'    => __( 'Select who should have access to the content.', 'content-restriction' ),
    2525            'type'    => 'section',
     26            'group'   => 'wordpress',
    2627            'options' => [
    2728                'roles' => [
     
    4041            'desc'    => __( 'Select who should have access to the content.', 'content-restriction' ),
    4142            'type'    => 'section',
     43            'group'   => 'wordpress',
    4244            'options' => [
    4345                'users' => [
     
    5052
    5153        $modules[] = [
    52             'name' => __( 'Logged In User', 'content-restriction' ),
    53             'key'  => 'user_logged_in',
    54             'icon' => $this->get_icon( 'WordPress' ),
    55             'desc' => __( 'Only logged in user should have access to the content.', 'content-restriction' ),
     54            'name'  => __( 'Logged In User', 'content-restriction' ),
     55            'key'   => 'user_logged_in',
     56            'icon'  => $this->get_icon( 'WordPress' ),
     57            'desc'  => __( 'Only logged in user should have access to the content.', 'content-restriction' ),
     58            'group' => 'wordpress',
    5659        ];
    5760
    5861        $modules[] = [
    59             'name' => __( 'Logged Out User', 'content-restriction' ),
    60             'key'  => 'user_not_logged_in',
    61             'icon' => $this->get_icon( 'WordPress' ),
    62             'desc' => __( 'Only logged out user should have access to the content.', 'content-restriction' ),
     62            'name'  => __( 'Logged Out User', 'content-restriction' ),
     63            'key'   => 'user_not_logged_in',
     64            'icon'  => $this->get_icon( 'WordPress' ),
     65            'desc'  => __( 'Only logged out user should have access to the content.', 'content-restriction' ),
     66            'group' => 'wordpress',
    6367        ];
    6468
  • content-restriction/trunk/app/Providers/FrontendServiceProviders.php

    r3142420 r3294741  
    2525            \ContentRestriction\Modules\LoginBack\Frontend::class,
    2626            \ContentRestriction\Modules\Replace\Frontend::class,
     27            \ContentRestriction\Modules\Shortcode\Frontend::class,
    2728            \ContentRestriction\Modules\Pages\Frontend::class,
    2829            \ContentRestriction\Modules\Posts\Frontend::class,
  • content-restriction/trunk/app/Providers/RestrictionServiceProviders.php

    r3137277 r3294741  
    1616        }
    1717
     18        // Flow - Restrict View > Who Can See > What Content
     19
    1820        /**
    1921         * Blur, Randomize, & Replace
     
    2426
    2527        /**
    26          *  Hide
     28         * Hide
    2729         */
    2830        add_action( 'pre_get_posts', [$this, 'pre_get_posts'], 110 );
  • content-restriction/trunk/app/Repositories/ModuleRepository.php

    r3142420 r3294741  
    33 * @package ContentRestriction
    44 * @since   1.0.0
    5  * @version 1.0.0
     5 * @version 1.4.0
    66 */
    77
     
    1010class ModuleRepository {
    1111    private array $restrictions;
     12    public static array $modules;
    1213
    1314    public function __construct() {
    14         $this->restrictions = $this->get_restrictions();
    15     }
    16 
    17     public function has_restrictions() {
    18         if ( empty( $this->restrictions ) ) {
    19             return false;
    20         }
    21 
    22         return true;
    23     }
    24 
    25     private function get_restrictions(): array {
    26         if ( isset( $this->restrictions ) ) {
    27             return $this->restrictions;
    28         }
    29 
    30         return ( new RuleRepository() )->get_all();
     15        $this->restrictions = $this->fetch_restrictions();
    3116    }
    3217
    3318    /**
    34      * Based on the restrictions,
    35      * Load respective modules
     19     * Checks if any restrictions are defined.
     20     *
     21     * @return bool True if restrictions are present; false otherwise.
    3622     */
    37     public function load() {
     23    public function has_restrictions(): bool {
     24        return ! empty( $this->restrictions );
     25    }
     26
     27    /**
     28     * Retrieves all restriction rules.
     29     *
     30     * @return array List of restriction rules.
     31     */
     32    private function fetch_restrictions(): array {
     33        return $this->restrictions ?? ( new RuleRepository() )->get_all();
     34    }
     35
     36    /**
     37     * Loads and initializes applicable restriction modules based on active rules.
     38     */
     39    public function load(): void {
     40        // Exit if running in admin mode to prevent frontend restrictions from affecting admin
    3841        if ( is_admin() ) {
    3942            return;
    4043        }
    4144
    42         foreach ( $this->restrictions as $key => $rule ) {
    43             if ( ! isset( $rule['status'] ) || ! $rule['status'] ) {
     45        // Get available restriction modules once for efficiency
     46        self::$modules = $this->get_modules();
     47
     48        // Iterate through each restriction rule
     49        foreach ( $this->restrictions as $rule ) {
     50            // Skip rule if it's inactive or invalid
     51            if ( empty( $rule['status'] ) || ! self::is_valid_rule( $rule['rule'] ) ) {
    4452                continue;
    4553            }
    4654
    47             if (
    48                 ! isset( $rule['rule']['who-can-see'] ) ||
    49                 ! isset( $rule['rule']['what-content'] ) ||
    50                 ! isset( $rule['rule']['restrict-view'] ) ) {
    51                 continue;
    52             }
     55            // Resolve modules for "who can see," "what content," and "restrict view"
     56            $who_can_see   = self::resolve_rule_module( $rule['rule']['who-can-see'] );
     57            $what_content  = self::resolve_rule_module( $rule['rule']['what-content'] );
     58            $restrict_view = self::resolve_rule_module( $rule['rule']['restrict-view'] );
    5359
    54             $who_can_see   = is_array( $rule['rule']['who-can-see'] ) ? array_key_first( $rule['rule']['who-can-see'] ) : $rule['rule']['who-can-see'];
    55             $what_content  = is_array( $rule['rule']['what-content'] ) ? array_key_first( $rule['rule']['what-content'] ) : $rule['rule']['what-content'];
    56             $restrict_view = is_array( $rule['rule']['restrict-view'] ) ? array_key_first( $rule['rule']['restrict-view'] ) : $rule['rule']['restrict-view'];
     60            // Check that all required modules exist in the loaded modules array
     61            if ( isset( self::$modules[$who_can_see], self::$modules[$what_content], self::$modules[$restrict_view] ) ) {
    5762
    58             $modules        = $this->get();
    59             $_who_can_see   = $modules[$who_can_see] ?? '';
    60             $_what_content  = $modules[$what_content] ?? '';
    61             $_restrict_view = $modules[$restrict_view] ?? '';
     63                // Initialize and boot the restriction view module with resolved modules
     64                $restriction_module = new self::$modules[$restrict_view](
     65                    self::$modules[$who_can_see],
     66                    self::$modules[$what_content],
     67                    $rule
     68                );
    6269
    63             if ( $_who_can_see && $_what_content && $_restrict_view ) {
    64                 ( new $_restrict_view( $_who_can_see, $_what_content, $rule ) )->boot();
     70                $restriction_module->boot();
    6571            }
    6672        }
     
    6874
    6975    /**
    70      * To add more modules,
    71      * use the @hook `content_restriction_load_modules`
     76     * Retrieves all module class mappings with an option for additional modules via hooks.
     77     *
     78     * @return array List of available module classes.
    7279     */
    73     private function get() {
     80    private function get_modules(): array {
    7481        return apply_filters(
    7582            'content_restriction_load_modules',
    7683            [
     84                // Restriction Types
    7785                'blur'                  => \ContentRestriction\Modules\Blur\Blur::class,
    7886                'hide'                  => \ContentRestriction\Modules\Hide\Hide::class,
     
    8189                'redirection'           => \ContentRestriction\Modules\Redirection\Redirection::class,
    8290
     91                // Content Types
    8392                'all_pages'             => \ContentRestriction\Modules\Pages\AllPages::class,
    8493                'specific_pages'        => \ContentRestriction\Modules\Pages\SpecificPages::class,
    8594                'frontpage'             => \ContentRestriction\Modules\Pages\Frontpage::class,
    8695
     96                // Post Types
    8797                'all_posts'             => \ContentRestriction\Modules\Posts\AllPosts::class,
    8898                'specific_posts'        => \ContentRestriction\Modules\Posts\SpecificPosts::class,
     
    90100                'posts_with_tags'       => \ContentRestriction\Modules\Posts\PostsWithTags::class,
    91101
     102                'shortcode'             => \ContentRestriction\Modules\Shortcode\Shortcode::class,
     103
     104                // User Types
    92105                'selected_roles'        => \ContentRestriction\Modules\WordPressUsers\SelectedRoles::class,
    93106                'selected_users'        => \ContentRestriction\Modules\WordPressUsers\SelectedUsers::class,
     
    97110        );
    98111    }
     112
     113    /**
     114     * Verifies the rule's structure to ensure required modules are set.
     115     *
     116     * @param array $rule Rule data array.
     117     * @return bool True if the rule is valid; false otherwise.
     118     */
     119    public static function is_valid_rule( array $rule ): bool {
     120        return isset(
     121            $rule['who-can-see'],
     122            $rule['what-content'],
     123            $rule['restrict-view']
     124        );
     125    }
     126
     127    /**
     128     * Retrieves the primary key of a rule module, handling array structures if needed.
     129     *
     130     * @param mixed $module Rule module data, potentially an array.
     131     * @return string|null Primary key of the module or null if undefined.
     132     */
     133    public static function resolve_rule_module( $module ): ?string {
     134        return is_array( $module ) ? array_key_first( $module ) : $module;
     135    }
     136
     137    /**
     138     * Get Specific Module by key
     139     */
     140    public static function get_module( string $key ) {
     141        return self::$modules[$key] ?? '';
     142    }
    99143}
  • content-restriction/trunk/app/Repositories/RuleRepository.php

    r3180815 r3294741  
    6868    }
    6969
     70    public function get( string $id ): array {
     71        // Fetch the rule by id using RuleModel
     72        $rule = ( new RuleModel )->get( $id );
     73
     74        // Return an empty array if no rule is found
     75        if ( ! $rule ) {
     76            return [];
     77        }
     78
     79        // Format the retrieved rule to match the structure used in get_all()
     80        $rule['status']     = (bool) $rule['status'];
     81        $rule['modified']   = strtotime( $rule['modified'] );
     82        $rule['created_at'] = strtotime( $rule['created_at'] );
     83
     84        $rule['rule']['who-can-see']   = maybe_unserialize( $rule['who_can_see'] );
     85        $rule['rule']['what-content']  = maybe_unserialize( $rule['what_content'] );
     86        $rule['rule']['restrict-view'] = maybe_unserialize( $rule['restrict_view'] );
     87
     88        unset( $rule['who_can_see'] );
     89        unset( $rule['what_content'] );
     90        unset( $rule['restrict_view'] );
     91
     92        return $rule;
     93    }
     94
    7095    public function get_all(): array {
    7196        $rules = ( new RuleModel )->get_all();
  • content-restriction/trunk/app/Utils/Logger.php

    r3147717 r3294741  
    99class Logger {
    1010    public static function add( $data, string $prefix = '' ) {
    11         error_log( $prefix . ' : ' . print_r( $data, true ) );
     11        if ( defined( 'WP_DEBUG' ) && WP_DEBUG ) {
     12            error_log( $prefix . ' : ' . print_r( $data, true ) );
     13        }
    1214    }
    1315}
  • content-restriction/trunk/assets/704.css

    r3180815 r3294741  
    11.react-tabs{-webkit-tap-highlight-color:transparent}.react-tabs__tab-list{border-bottom:1px solid #aaa;margin:0 0 10px;padding:0}.react-tabs__tab{border:1px solid transparent;border-bottom:none;bottom:-1px;cursor:pointer;display:inline-block;list-style:none;padding:6px 12px;position:relative}.react-tabs__tab--selected{background:#fff;border-color:#aaa;border-radius:5px 5px 0 0;color:#000}.react-tabs__tab--disabled{color:GrayText;cursor:default}.react-tabs__tab:focus{outline:none}.react-tabs__tab:focus:after{background:#fff;bottom:-5px;content:"";height:5px;left:-4px;position:absolute;right:-4px}.react-tabs__tab-panel{display:none}.react-tabs__tab-panel--selected{display:block}
    2 .content-restriction__rules{min-height:calc(70vh - 80px);padding:30px 20px}.content-restriction__rules__header{align-items:center;display:flex;justify-content:space-between;padding:50px 25px 25px}.content-restriction__rules__header__title{font-size:32px;font-weight:700}.content-restriction__rules__list{background-color:#fff!important;border-radius:var(--content-restriction-border-radius);border-spacing:unset;padding:40px;width:100%}.content-restriction__rules__list__header th{border-bottom:2px solid #ccc;color:#000;font-size:14px;font-weight:700;padding:16px 5px!important;text-align:start}.content-restriction__rules__list__header th:first-child{padding-inline-start:0}.content-restriction__rules__body td{border-bottom:1px solid #ccc;box-sizing:border-box;color:#000;font-size:14px;font-weight:400;height:55px;padding:16px 5px!important}.content-restriction__rules__body td:last-child{justify-content:flex-end;padding-inline-end:0}.content-restriction__rules__body td:first-child{padding-inline-start:0}.content-restriction__rules__body a{align-items:center;color:#000;display:flex;font-size:14px;font-weight:500;gap:10px;text-decoration:none}.content-restriction__rules__body a:hover{color:var(--content-restriction-primary-color)}.content-restriction__rules__icon{display:flex;gap:5px}.content-restriction__rules__action{display:flex;gap:20px}.content-restriction__rules__action a{border:none;box-shadow:none}.content-restriction__rules__action .delete-btn svg path,.content-restriction__rules__action a svg path{fill:var(--content-restriction-primary-color)}.content-restriction__create-rules{align-items:center;display:flex;flex-direction:column;gap:70px;justify-content:center;min-height:calc(90vh - 80px)}.content-restriction__single{position:relative}.content-restriction__single__btn{align-items:center;background-color:#fff;border-radius:var(--content-restriction-border-radius);box-sizing:border-box;color:#000;cursor:pointer;display:flex;font-size:16px;font-weight:700;gap:10px;padding:12px 20px;position:relative;transition:all .3s ease;width:385px}.content-restriction__single__btn img{border-radius:var(--content-restriction-border-radius);box-shadow:0 0 3px #ddd;flex:1;max-width:25px;padding:6px 8px}.content-restriction__single__btn__title{flex:1;font-size:16px;margin:0}.content-restriction__single__btn__action{height:100%;text-align:end}.content-restriction__single__btn:hover{box-shadow:0 5px 10px 0 rgba(0,0,0,.1)}.content-restriction__single__btn.disabled{opacity:.5;pointer-events:none}.content-restriction__single__btn__dropdown{box-shadow:0 0 15px rgba(0,0,0,.082);inset-inline-start:100%;margin:0;opacity:0;position:absolute;top:0;transform:translateY(-10px);transition:all .3s ease;visibility:hidden;width:125px;z-index:1}.content-restriction__single__btn__dropdown.active{opacity:1;transform:translateY(0);visibility:visible}.content-restriction__single__btn__dropdown__item{cursor:auto;margin:0}.content-restriction__single__btn__dropdown__btn{background-color:#fff;color:#000;font-size:14px;padding:8px 25px;transition:all .3s ease;width:100%}.content-restriction__single__btn__dropdown__btn:hover{box-shadow:0 5px 10px 0 rgba(0,0,0,.1)}.content-restriction__single__btn__dropdown__btn.disabled{color:#95928e;pointer-events:none}.content-restriction__single__btn__dropdown__btn--delete{border-radius:var(--content-restriction-border-radius);color:#f5f5f5;padding:12px 25px}.content-restriction__single__btn__dropdown__btn--delete,.content-restriction__single__btn__dropdown__btn--delete:hover{background-color:var(--content-restriction-primary-color)}.content-restriction__single:before{align-items:center;border-radius:100%;content:"Then Unlock";display:flex;font-size:15px;height:20px;justify-content:center;left:50%;position:absolute;top:calc(100% + 28px);transform:translateX(calc(-50% + 1px));width:200px;z-index:1}.content-restriction__single:nth-child(2):before{content:"Otherwise, Restrict Using"}.content-restriction__single:after{border-right:2px dashed #d7d5d2;content:"";height:70px;left:50%;position:absolute;top:100%;transform:translateX(-50%);width:2px}.content-restriction__single:last-child:after,.content-restriction__single:last-child:before{display:none}.content-restriction__modal{pointer-events:none}.content-restriction__modal__overlay{background-color:rgba(0,0,0,.5);height:100%;left:0;opacity:0;position:fixed;top:0;transition:opacity .5s;width:100%;z-index:2}.content-restriction__modal__content{border-radius:var(--content-restriction-border-radius);display:flex;flex-direction:column;left:50%;max-height:550px;max-width:900px;opacity:0;overflow-y:auto;position:absolute;top:50%;transform:translate(-50%,-50%) scale(.9);transition:opacity .3s,transform .5s;width:100%;z-index:2}.content-restriction__modal__content__title{margin:10px 0}.content-restriction__modal__content__desc{margin-bottom:0}.content-restriction__modal__content__header{background:#1f3121;display:flex;gap:20px;justify-content:space-between;padding:20px}.content-restriction__modal__content__header__info{align-items:center;display:flex;gap:10px}.content-restriction__modal__content__header__info .info-icon{background:#fff;border-radius:var(--content-restriction-border-radius);padding:10px}.content-restriction__modal__content__header__action{align-items:center;display:flex;gap:10px}.content-restriction__modal__content__header__action__btn{align-items:center;background-color:transparent;border:1px solid #fff;border-radius:var(--content-restriction-border-radius);color:#fff;display:flex;font-size:14px;font-weight:500;gap:10px;justify-content:center;padding:10px 25px;text-decoration:none;transition:all .3s ease;white-space:nowrap}.content-restriction__modal__content__header__action__btn:hover{background-color:#fff;border-color:#fff;color:#000}.content-restriction__modal__content__title{color:#fff;font-size:24px;font-weight:700}.content-restriction__modal__content__desc{color:#fff;font-size:14px;font-weight:400}.content-restriction__modal__content__btn{align-items:center;background-color:#fff;border-radius:var(--content-restriction-border-radius);color:#000;cursor:pointer;display:flex;justify-content:center;padding:10px 25px}.content-restriction__modal__content__close-btn{align-items:center;border-radius:50%;color:#fff;cursor:pointer;display:flex;font-size:20px;height:30px;justify-content:center;width:30px}.content-restriction__modal__content__body{background:#fff;color:#000;font-size:16px;font-weight:400}.content-restriction__modal__content__wrapper{align-items:flex-start;display:flex}.content-restriction__modal--visible{pointer-events:auto}.content-restriction__modal--visible .content-restriction__modal__content,.content-restriction__modal--visible .content-restriction__modal__overlay{opacity:1}.content-restriction__modal--visible .content-restriction__modal__content{opacity:1;transform:translate(-50%,-50%) scale(1)}.content-restriction__module{display:flex;flex:1;flex-direction:column;gap:15px;padding:15px}.content-restriction__type{align-items:center;display:flex;flex-wrap:wrap;gap:5px;margin-top:0}.content-restriction__type__item{flex:0 0 32.94%;margin:0}.content-restriction__type .pro-item .pro-badge,.content-restriction__type .pro-item .upcoming-badge{font-size:12px;padding:3px 8px;position:absolute;right:15px;text-align:right}.content-restriction__type .pro-item .upcoming-badge{background:#93003f;background:#ecfdf5;border-radius:100px;color:#fff;color:#047857}.content-restriction__type .pro-item{position:relative}.content-restriction__type__btn{align-content:baseline;align-items:center;border:1px solid #e6e6e6;border-radius:var(--content-restriction-border-radius);color:#000;display:flex;flex-direction:column;flex-wrap:wrap;flex-flow:column;font-size:15px;font-weight:600;min-height:205px;padding:15px;transition:all .3s ease;white-space:nowrap;width:100%}.content-restriction__type__btn h3{font-size:1.1em}.content-restriction__type__btn img{border-radius:var(--content-restriction-border-radius);margin-right:5px;max-width:40px;padding:2px}.content-restriction__type__btn span{font-weight:400;line-height:1.6;text-align:center;white-space:normal}.content-restriction__type__btn:hover{border-color:#d1cdcd;box-shadow:0 10px 15px 5px rgba(0,0,0,.1)}.content-restriction__sidebar{pointer-events:none}.content-restriction__sidebar__overlay{background-color:rgba(0,0,0,.5);height:100%;left:0;opacity:0;position:fixed;top:0;transition:opacity .5s;width:100%}.content-restriction__sidebar__content{background:#fff;border-radius:var(--content-restriction-border-radius);box-shadow:0 20px 30px 0 rgba(0,0,0,.1);display:flex;flex-direction:column;gap:15px;height:100vh;max-width:500px;opacity:0;padding:15px 0;position:absolute;right:0;top:70px;transform:translateX(50px);transition:opacity .3s,transform .5s;width:100%;z-index:1}.content-restriction__sidebar__content__header{display:flex;gap:20px;padding:0 20px}.content-restriction__sidebar__content__title{align-items:center;color:#000;display:flex;flex:1;font-size:24px;font-weight:700;line-height:30px;margin:0}.content-restriction__sidebar__content__btn{align-items:center;background-color:transparent;border:1.5px solid rgba(0,0,0,.05);border-radius:var(--content-restriction-border-radius);color:#1d2327;display:flex;font-size:14px;gap:10px;height:40px;justify-content:center;padding:8px 20px;transition:all .3s ease}.content-restriction__sidebar__content__btn:hover{background-color:rgba(0,0,0,.5);color:#fff}.content-restriction__sidebar__content__close-btn{align-items:center;border-radius:50%;color:#000;cursor:pointer;display:flex;font-size:20px;height:30px;justify-content:center;width:30px}.content-restriction__sidebar__content__body{color:#000;font-size:16px;font-weight:400}.content-restriction__sidebar--visible{pointer-events:auto}.content-restriction__sidebar--visible .content-restriction__sidebar__content,.content-restriction__sidebar--visible .content-restriction__sidebar__overlay{opacity:1}.content-restriction__sidebar--visible .content-restriction__sidebar__content{opacity:1;transform:translateX(0)}.content-restriction__sidebar__tab{display:flex;flex-direction:column}.content-restriction__sidebar__tab__header{background:transparent!important;border:none;border-bottom:2px solid #e8e7e4;margin:0;padding:0 20px}.content-restriction__sidebar__tab__content{border-top:1.5px solid #000;padding:20px}.content-restriction__sidebar__tab__content__event{margin:20px 0 0}.content-restriction__sidebar__tab__content__event__desc{font-size:16px;line-height:2}.content-restriction__sidebar__tab__content__event__title{color:#000;font-size:20px;font-weight:400;line-height:26px;margin:0}.content-restriction__sidebar__tab__content__event__wrapper{display:flex;flex-direction:column;flex-wrap:wrap;gap:10px;margin:20px 0 0;position:relative}.content-restriction__sidebar__tab__content__event__section-wrapper{display:flex;flex-direction:column;gap:10px}.content-restriction__sidebar__tab__content__event__btn{align-items:center;background-color:transparent;border:2px solid #95928e;border-radius:var(--content-restriction-border-radius);box-shadow:0 5px 10px 0 rgba(0,0,0,.1);color:#000;cursor:pointer;display:flex;font-size:16px;gap:60px;justify-content:space-between;padding:8px 20px;position:relative;transition:all .3s ease;width:100%}.content-restriction__sidebar__tab__content__event__btn:hover{border-color:var(--content-restriction-primary-color)}.content-restriction__sidebar__tab__content__event__dropdown{background-color:#fff;border:1px solid #95928e;opacity:0;position:absolute;right:0;top:100%;transform:translateY(-10px);transition:all .3s ease;visibility:hidden;width:100%;z-index:1}.content-restriction__sidebar__tab__content__event__dropdown.active{opacity:1;transform:translateY(0);visibility:visible}.content-restriction__sidebar__tab__content__event__dropdown.active .content-restriction__sidebar__tab__content__event__dropdown__btn{pointer-events:auto}.content-restriction__sidebar__tab__content__event__dropdown__item{margin:0}.content-restriction__sidebar__tab__content__event__dropdown__btn{background-color:transparent;color:#000;padding:8px 25px;pointer-events:none;text-align:left;transition:all .3s ease;width:100%}.content-restriction__sidebar__tab__content__event__dropdown__btn:hover{box-shadow:0 5px 10px 0 rgba(0,0,0,.1)}.content-restriction__sidebar__tab .react-tabs__tab{background:transparent;border:none;border-bottom:2px solid transparent;box-sizing:border-box;color:#444;margin:0;width:100%}.content-restriction__sidebar__tab .react-tabs__tab:after{display:none}.content-restriction__sidebar__tab .react-tabs__tab.react-tabs__tab--selected{border-color:#000;color:#000;font-weight:700}
     2.content-restriction__rules{min-height:calc(70vh - 80px);padding:30px 20px}.content-restriction__rules__header{align-items:center;display:flex;justify-content:space-between;padding:50px 25px 25px}.content-restriction__rules__header__title{font-size:32px;font-weight:700}.content-restriction__rules__list{background-color:#fff!important;border-radius:var(--content-restriction-border-radius);border-spacing:unset;padding:40px;width:100%}.content-restriction__rules__list__header th{border-bottom:2px solid #ccc;color:#000;font-size:14px;font-weight:700;padding:16px 5px!important;text-align:start}.content-restriction__rules__list__header th:first-child{padding-inline-start:0}.content-restriction__rules__body td{border-bottom:1px solid #ccc;box-sizing:border-box;color:#000;font-size:14px;font-weight:400;height:55px;padding:16px 5px!important}.content-restriction__rules__body td:last-child{justify-content:flex-end;padding-inline-end:0}.content-restriction__rules__body td:first-child{padding-inline-start:0}.content-restriction__rules__body a{align-items:center;color:#000;display:flex;font-size:14px;font-weight:500;gap:10px;text-decoration:none}.content-restriction__rules__body a:hover{color:var(--content-restriction-primary-color)}.content-restriction__rules__icon{display:flex;gap:5px}.content-restriction__rules__action{display:flex;gap:20px}.content-restriction__rules__action a{border:none;box-shadow:none}.content-restriction__rules__action .delete-btn svg path,.content-restriction__rules__action a svg path{fill:var(--content-restriction-primary-color)}.content-restriction__create-rules{align-items:center;display:flex;flex-direction:column;gap:70px;justify-content:center;min-height:calc(90vh - 80px)}.content-restriction__single{position:relative}.content-restriction__single__btn{align-items:center;background-color:#fff;border-radius:var(--content-restriction-border-radius);box-sizing:border-box;color:#000;cursor:pointer;display:flex;font-size:16px;font-weight:700;gap:10px;padding:12px 20px;position:relative;transition:all .3s ease;width:385px}.content-restriction__single__btn img{border-radius:var(--content-restriction-border-radius);box-shadow:0 0 3px #ddd;flex:1;max-width:25px;padding:6px 8px}.content-restriction__single__btn__title{flex:1;font-size:16px;margin:0}.content-restriction__single__btn__action{height:100%;text-align:end}.content-restriction__single__btn:hover{box-shadow:0 5px 10px 0 rgba(0,0,0,.1)}.content-restriction__single__btn.disabled{opacity:.5;pointer-events:none}.content-restriction__single__btn__dropdown{box-shadow:0 0 15px rgba(0,0,0,.082);inset-inline-start:100%;margin:0;opacity:0;position:absolute;top:0;transform:translateY(-10px);transition:all .3s ease;visibility:hidden;width:125px;z-index:1}.content-restriction__single__btn__dropdown.active{opacity:1;transform:translateY(0);visibility:visible}.content-restriction__single__btn__dropdown__item{cursor:auto;margin:0}.content-restriction__single__btn__dropdown__btn{background-color:#fff;color:#000;font-size:14px;padding:8px 25px;transition:all .3s ease;width:100%}.content-restriction__single__btn__dropdown__btn:hover{box-shadow:0 5px 10px 0 rgba(0,0,0,.1)}.content-restriction__single__btn__dropdown__btn.disabled{color:#95928e;pointer-events:none}.content-restriction__single__btn__dropdown__btn--delete{border-radius:var(--content-restriction-border-radius);color:#f5f5f5;padding:12px 25px}.content-restriction__single__btn__dropdown__btn--delete,.content-restriction__single__btn__dropdown__btn--delete:hover{background-color:var(--content-restriction-primary-color)}.content-restriction__single:before{align-items:center;border-radius:100%;content:"Then Unlock";display:flex;font-size:15px;height:20px;justify-content:center;left:50%;position:absolute;top:calc(100% + 28px);transform:translateX(calc(-50% + 1px));width:200px;z-index:1}.content-restriction__single:nth-child(2):before{content:"Otherwise, Restrict Using"}.content-restriction__single:after{border-right:2px dashed #d7d5d2;content:"";height:70px;left:50%;position:absolute;top:100%;transform:translateX(-50%);width:2px}.content-restriction__single:last-child:after,.content-restriction__single:last-child:before{display:none}.content-restriction__modal{pointer-events:none}.content-restriction__modal__overlay{background-color:rgba(0,0,0,.5);height:100%;left:0;opacity:0;position:fixed;top:0;transition:opacity .5s;width:100%;z-index:2}.content-restriction__modal__content{border-radius:var(--content-restriction-border-radius);display:flex;flex-direction:column;left:50%;max-height:550px;max-width:1000px;opacity:0;position:absolute;top:50%;transform:translate(-50%,-50%) scale(.9);transition:opacity .3s,transform .5s;width:100%;z-index:2}.content-restriction__modal__content__title{margin:10px 0}.content-restriction__modal__content__desc{margin-bottom:0}.content-restriction__modal__content__header{background:#1f3121;box-sizing:border-box;display:flex;gap:20px;justify-content:space-between;left:0;padding:20px;position:absolute;top:0;width:100%;z-index:1}.content-restriction__modal__content__header__info{align-items:center;display:flex;gap:10px}.content-restriction__modal__content__header__info .info-icon{background:#fff;border-radius:var(--content-restriction-border-radius);padding:10px}.content-restriction__modal__content__header__action{align-items:center;display:flex;gap:10px}.content-restriction__modal__content__header__action__btn{align-items:center;background-color:transparent;border:1px solid #fff;border-radius:var(--content-restriction-border-radius);color:#fff;display:flex;font-size:14px;font-weight:500;gap:10px;justify-content:center;padding:10px 25px;text-decoration:none;transition:all .3s ease;white-space:nowrap}.content-restriction__modal__content__header__action__btn:hover{background-color:#fff;border-color:#fff;color:#000}.content-restriction__modal__content__title{color:#fff;font-size:24px;font-weight:700}.content-restriction__modal__content__desc{color:#fff;font-size:14px;font-weight:400}.content-restriction__modal__content__btn{align-items:center;background-color:#fff;border-radius:var(--content-restriction-border-radius);color:#000;cursor:pointer;display:flex;justify-content:center;padding:10px 25px}.content-restriction__modal__content__close-btn{align-items:center;border-radius:50%;color:#fff;cursor:pointer;display:flex;font-size:20px;height:30px;justify-content:center;width:30px}.content-restriction__modal__content__body{background:#fff;color:#000;font-size:16px;font-weight:400}.content-restriction__modal__content__wrapper{align-items:flex-start;display:flex}.content-restriction__modal--visible{pointer-events:auto}.content-restriction__modal--visible .content-restriction__modal__content,.content-restriction__modal--visible .content-restriction__modal__overlay{opacity:1}.content-restriction__modal--visible .content-restriction__modal__content{opacity:1;transform:translate(-50%,-50%) scale(1)}.content-restriction__module{display:flex;flex:1;flex-wrap:wrap;gap:15px;padding:0 15px}.content-restriction__group{display:flex;flex-direction:column;gap:6px;height:100%;left:15px;margin:0;position:absolute;top:123px;width:200px}.content-restriction__group~.content-restriction__type{padding-left:215px}.content-restriction__group~.content-restriction__type .content-restriction__type__item{flex:0 0 32.8%;max-width:33%}@media screen and (max-width:768px){.content-restriction__group{flex-direction:row;justify-content:center;width:100%}}.content-restriction__group__item{margin:0}.content-restriction__group__btn{background-color:#e6e6e6;border-radius:6px;padding:10px 15px;transition:all .3s ease;width:100%}.content-restriction__group__btn.active,.content-restriction__group__btn:hover{background-color:#1f3121;color:#fff}.content-restriction__type{align-items:center;box-sizing:border-box;display:flex;flex:1;flex-wrap:wrap;gap:5px;margin:0;max-height:550px;min-height:360px;overflow-y:auto;padding:123px 0 15px;scrollbar-width:thin}.content-restriction__type__item{flex:0 0 32.84%;margin:0;max-width:32.84%}.content-restriction__type .pro-item .pro-badge,.content-restriction__type .pro-item .upcoming-badge{font-size:12px;padding:3px 8px;position:absolute;right:15px;text-align:right}.content-restriction__type .pro-item .upcoming-badge{background:#93003f;background:#ecfdf5;border-radius:100px;color:#fff;color:#047857}.content-restriction__type .pro-item{position:relative}.content-restriction__type__btn{align-content:baseline;align-items:center;border:1px solid #e6e6e6;border-radius:var(--content-restriction-border-radius);color:#000;display:flex;flex-direction:column;flex-wrap:wrap;flex-flow:column;font-size:15px;font-weight:600;min-height:205px;padding:15px;transition:all .3s ease;white-space:nowrap;width:100%}.content-restriction__type__btn h3{font-size:1.1em}.content-restriction__type__btn img{border-radius:var(--content-restriction-border-radius);margin-right:5px;max-width:40px;padding:2px}.content-restriction__type__btn span{font-weight:400;line-height:1.6;text-align:center;white-space:normal}.content-restriction__type__btn:hover{border-color:#d1cdcd;box-shadow:0 10px 15px 5px rgba(0,0,0,.1)}.content-restriction__sidebar{pointer-events:none}.content-restriction__sidebar__overlay{background-color:rgba(0,0,0,.5);height:100%;left:0;opacity:0;position:fixed;top:0;transition:opacity .5s;width:100%}.content-restriction__sidebar__content{background:#fff;border-radius:var(--content-restriction-border-radius);box-shadow:0 20px 30px 0 rgba(0,0,0,.1);display:flex;flex-direction:column;gap:15px;height:calc(90vh - 80px);max-width:500px;opacity:0;overflow-y:auto;padding:15px 0;position:absolute;right:0;top:70px;transform:translateX(50px);transition:opacity .3s,transform .5s;width:100%;z-index:1}.content-restriction__sidebar__content__header{display:flex;gap:20px;padding:0 20px}.content-restriction__sidebar__content__title{align-items:center;color:#000;display:flex;flex:1;font-size:24px;font-weight:700;line-height:30px;margin:0}.content-restriction__sidebar__content__btn{align-items:center;background-color:transparent;border:1.5px solid rgba(0,0,0,.05);border-radius:var(--content-restriction-border-radius);color:#1d2327;display:flex;font-size:14px;gap:10px;height:40px;justify-content:center;padding:8px 20px;transition:all .3s ease}.content-restriction__sidebar__content__btn:hover{background-color:rgba(0,0,0,.5);color:#fff}.content-restriction__sidebar__content__close-btn{align-items:center;border-radius:50%;color:#000;cursor:pointer;display:flex;font-size:20px;height:30px;justify-content:center;width:30px}.content-restriction__sidebar__content__body{color:#000;font-size:16px;font-weight:400}.content-restriction__sidebar--visible{pointer-events:auto}.content-restriction__sidebar--visible .content-restriction__sidebar__content,.content-restriction__sidebar--visible .content-restriction__sidebar__overlay{opacity:1}.content-restriction__sidebar--visible .content-restriction__sidebar__content{opacity:1;transform:translateX(0)}.content-restriction__sidebar__tab{display:flex;flex-direction:column}.content-restriction__sidebar__tab__header{background:transparent!important;border:none;border-bottom:2px solid #e8e7e4;margin:0;padding:0 20px}.content-restriction__sidebar__tab__content{border-top:1.5px solid #000;padding:20px}.content-restriction__sidebar__tab__content__event{margin:20px 0 0}.content-restriction__sidebar__tab__content__event__desc{font-size:16px;line-height:2}.content-restriction__sidebar__tab__content__event__title{color:#000;font-size:20px;font-weight:400;line-height:26px;margin:0}.content-restriction__sidebar__tab__content__event__wrapper{display:flex;flex-direction:column;flex-wrap:wrap;gap:10px;margin:20px 0 0;position:relative}.content-restriction__sidebar__tab__content__event__section-wrapper{display:flex;flex-direction:column;gap:10px}.content-restriction__sidebar__tab__content__event__btn{align-items:center;background-color:transparent;border:2px solid #95928e;border-radius:var(--content-restriction-border-radius);box-shadow:0 5px 10px 0 rgba(0,0,0,.1);color:#000;cursor:pointer;display:flex;font-size:16px;gap:60px;justify-content:space-between;padding:8px 20px;position:relative;transition:all .3s ease;width:100%}.content-restriction__sidebar__tab__content__event__btn:hover{border-color:var(--content-restriction-primary-color)}.content-restriction__sidebar__tab__content__event__dropdown{background-color:#fff;border:1px solid #95928e;opacity:0;position:absolute;right:0;top:100%;transform:translateY(-10px);transition:all .3s ease;visibility:hidden;width:100%;z-index:1}.content-restriction__sidebar__tab__content__event__dropdown.active{opacity:1;transform:translateY(0);visibility:visible}.content-restriction__sidebar__tab__content__event__dropdown.active .content-restriction__sidebar__tab__content__event__dropdown__btn{pointer-events:auto}.content-restriction__sidebar__tab__content__event__dropdown__item{margin:0}.content-restriction__sidebar__tab__content__event__dropdown__btn{background-color:transparent;color:#000;padding:8px 25px;pointer-events:none;text-align:left;transition:all .3s ease;width:100%}.content-restriction__sidebar__tab__content__event__dropdown__btn:hover{box-shadow:0 5px 10px 0 rgba(0,0,0,.1)}.content-restriction__sidebar__tab .react-tabs__tab{background:transparent;border:none;border-bottom:2px solid transparent;box-sizing:border-box;color:#444;margin:0;width:100%}.content-restriction__sidebar__tab .react-tabs__tab:after{display:none}.content-restriction__sidebar__tab .react-tabs__tab.react-tabs__tab--selected{border-color:#000;color:#000;font-weight:700}
    33.content-restriction__integrations{clear:both;padding-block-start:10px}.content-restriction__integrations__header{margin:30px auto 60px;max-width:770px;padding-top:40px;text-align:center}.content-restriction__integrations__header__title{font-size:32px}.content-restriction__integrations__header p{font-size:18px}.content-restriction__integrations__list{display:grid;grid-gap:20px;grid-template-columns:repeat(auto-fit,minmax(360px,1fr));padding:0 60px 60px}.content-restriction__integrations__list__item{align-items:flex-start;background-color:#fff;border:1px solid #e6e8ea;border-radius:var(--content-restriction-border-radius);display:flex;flex-direction:column;padding:20px 24px;transition:all .3s}.content-restriction__integrations__list__item__header{align-items:flex-start;display:flex;justify-content:space-between;width:100%}.content-restriction__integrations__list__item__header img{border-radius:var(--content-restriction-border-radius);display:flex;margin-block-end:20px;width:70px}.content-restriction__integrations__list__item__header .badge{background:#ecfdf5;border-radius:100px;color:#047857;padding:3px 8px}.content-restriction__integrations__list__item__title{font-size:20px;line-height:1.6;margin:0}.content-restriction__integrations__list__item__desc{flex-grow:1}.content-restriction__integrations__list__item__actions{align-items:center;display:flex;justify-content:space-between;margin-block-start:20px;width:100%}.content-restriction__integrations__list__item__actions .learn-more{text-decoration:none}.content-restriction__integrations__list__item__actions .action{background-color:var(--content-restriction-primary-color);border:none;border-radius:var(--content-restriction-border-radius);color:#fff;cursor:pointer;font-size:12px;font-weight:500;line-height:1.2;outline:none;padding:8px 16px;text-decoration:none;transition:var(--content-restriction-transition-hover)}
    44.content-restriction__settings{clear:both;margin:0 auto;padding-block-start:10px}.content-restriction__settings__header{margin:30px auto 15px;padding-top:40px;text-align:center}.content-restriction__settings .settings-save-button{margin-top:30px}.content-restriction__settings .site-layout-background{background:transparent}
  • content-restriction/trunk/assets/704.js

    r3180815 r3294741  
    1 "use strict";(self.webpackChunkcontent_restriction=self.webpackChunkcontent_restriction||[]).push([[704],{6704:(e,t,n)=>{n.r(t),n.d(t,{default:()=>le});var c=n(1609),r=n(4976),a=n(7767),i=n(6207),l=n(261),s=n(7143),o=n(6087);const _={modalVisible:!1,sidebarVisible:!1,ruleType:"",contentRule:{status:!1,id:"",ruleTitle:"",whoCanSee:{},whatContent:{},restrictView:{},ruleData:{}}},m=(0,s.createReduxStore)("content-restriction-stores",{reducer(e=(()=>_)(),t){let n;switch(t.type){case"SET_WHO_CAN_SEE":n={...e,contentRule:{...e.contentRule,whoCanSee:{...t.whoCanSee}}};break;case"SET_WHAT_CONTENT":n={...e,contentRule:{...e.contentRule,whatContent:{...t.whatContent}}};break;case"SET_RESTRICT_VIEW":n={...e,contentRule:{...e.contentRule,restrictView:{...t.restrictView}}};break;case"SET_RULE":n={...e,contentRule:{...e.contentRule,ruleData:t.rule}};break;case"SET_RULE_STATUS":n={...e,contentRule:{...e.contentRule,status:t.status}};break;case"SET_ID":n={...e,contentRule:{...e.contentRule,id:t.id}};break;case"SET_RULE_TITLE":n={...e,contentRule:{...e.contentRule,ruleTitle:t.ruleTitle}};break;case"SET_RULE_TYPE":n={...e,ruleType:t.ruleType};break;case"SET_MODAL_VISIBLE":n={...e,modalVisible:t.modalVisible};break;case"SET_SIDEBAR_VISIBLE":n={...e,sidebarVisible:t.sidebarVisible};break;default:n=e}return localStorage.setItem("content-restriction-stores",JSON.stringify(n)),n},actions:{setWhoCanSee:e=>({type:"SET_WHO_CAN_SEE",whoCanSee:e}),setWhatContent:e=>({type:"SET_WHAT_CONTENT",whatContent:e}),setRestrictView:e=>({type:"SET_RESTRICT_VIEW",restrictView:e}),setRule:e=>({type:"SET_RULE",rule:e}),setRulePublished:e=>({type:"SET_RULE_STATUS",status:e}),setId:e=>({type:"SET_ID",id:e}),setRuleTitle:e=>({type:"SET_RULE_TITLE",ruleTitle:e}),setRuleType:e=>({type:"SET_RULE_TYPE",ruleType:e}),setModalVisible:e=>({type:"SET_MODAL_VISIBLE",modalVisible:e}),setSidebarVisible:e=>({type:"SET_SIDEBAR_VISIBLE",sidebarVisible:e})},selectors:{getRuleData:e=>e.contentRule.ruleData,getRuleStatus:e=>e.contentRule.status,getId:e=>e.contentRule.id,getRuleTitle:e=>e.contentRule.ruleTitle,getWhoCanSee:e=>e.contentRule.whoCanSee,getWhatContent:e=>e.contentRule.whatContent,getRestrictView:e=>e.contentRule.restrictView,getRule:e=>e.contentRule,getRuleType:e=>e.ruleType,getModal:e=>e.modalVisible,getSidebar:e=>e.sidebarVisible}});(0,s.register)(m);const u=m;var d=n(1848),E=n(7723),h=n(1455),p=n.n(h);async function g(e,t,n){n=n||{},t=t||{};const c=[["X-WP-Nonce",content_restriction_admin.rest_args.nonce]];return await p()({path:e,method:"POST",data:t,headers:c,...n}).then((e=>e)).catch((e=>{throw e}))}const{confirm:M}=d.A;var N=n(2359);function b(e,t){N.Ay[e]({message:t,placement:"bottomLeft"})}function w({}){const[e,t]=(0,o.useState)({}),[n,_]=(0,o.useState)(""),[m,d]=(0,o.useState)("Untitled Rule"),[h,p]=(0,o.useState)(!1),[M,N]=(0,o.useState)(!1),[w,y]=(0,o.useState)(!1),v=(0,a.Zp)(),I=(0,s.select)("content-restriction-stores"),S=(0,o.useRef)(null),C=e=>{S.current&&!S.current.contains(e.target)&&y(!1)};(0,o.useEffect)((()=>(document.addEventListener("mousedown",C),()=>{document.removeEventListener("mousedown",C)})),[]),(0,o.useEffect)((()=>{const e=(0,s.subscribe)((()=>{const e=I.getId(),n=I.getRuleData(),c=I.getRuleTitle(),r=I.getRuleStatus();_(e),d(c||m),t(n),N(r)}));return()=>e()}));const T=(0,o.useRef)(null);(0,o.useEffect)((()=>{const e=e=>{if(h){const t=T.current?.contains(e.target),n=e.target.classList.contains("anticon-edit");t||n||p(!1)}};return document.addEventListener("click",e),()=>{document.removeEventListener("click",e)}}),[h]);const j=n?()=>function(e,t,n,c){t&&t.hasOwnProperty("who-can-see")&&t.hasOwnProperty("what-content")&&t.hasOwnProperty("restrict-view")?g("content-restriction/rules/update",{id:e,data:{status:c,title:n,rule:t}}).then((e=>{b("success",(0,E.__)("Successfully Updated!","content-restriction"))})).catch((e=>{b("error",(0,E.__)("Rules update error","content-restriction"))})):b("warning",(0,E.__)("Please complete the setup","content-restriction"))}(n,e,m,M):()=>function(e,t,n,c){e&&e.hasOwnProperty("who-can-see")&&e.hasOwnProperty("what-content")&&e.hasOwnProperty("restrict-view")?g("content-restriction/rules/create",{data:{status:n,title:t,rule:e}}).then((e=>{b("success",(0,E.__)("Successfully Created!","content-restriction")),c(`/rule/${e}`)})).catch((e=>{b("error",(0,E.__)("Rules create error","content-restriction"))})):b("warning",(0,E.__)("Please complete the setup","content-restriction"))}(e,m,M,v);return(0,c.createElement)(c.Fragment,null,(0,c.createElement)("div",{className:"content-restriction__header"},(0,c.createElement)("div",{className:"content-restriction__header__action content-restriction__header__action--left"},(0,c.createElement)(r.N_,{to:"/",class:"content-restriction__btn content-restriction__btn--sm content-restriction__btn--back"},(0,c.createElement)(i.A,null),(0,E.__)("Back","content-restriction")),(0,c.createElement)("div",{className:"content-restriction__header__action__input"},h?(0,c.createElement)("input",{type:"text",ref:T,value:m,onChange:e=>(0,s.dispatch)(u).setRuleTitle(e.target.value)}):(0,c.createElement)("h2",{className:"content-restriction__header__title"},m),(0,c.createElement)("p",{className:"content-restriction__header__action__edit"},h?(0,c.createElement)(i.A,{onClick:e=>{e.stopPropagation(),p(!1)}}):(0,c.createElement)(l.A,{onClick:e=>{e.stopPropagation(),p(!0)}})))),(0,c.createElement)("div",{className:"content-restriction__header__action content-restriction__header__action--right"},(0,c.createElement)("button",{className:"content-restriction__btn content-restriction__btn--create",onClick:j},n?(0,E.__)("Update","content-restriction"):(0,E.__)("Publish","content-restriction")))))}var y=n(2318),v=n(1005),I=n(3009);function S(e){const{id:t,type:n,openKey:r,setOpenKey:a,changeAction:i,resetType:l}=e,s=(0,o.useRef)(null);(0,o.useEffect)((()=>{const e=e=>{!s.current||s.current.contains(e.target)||e.target.closest(".ant-dropdown-trigger")||setTimeout((()=>{a(null)}),100)};return document.addEventListener("mousedown",e),()=>{document.removeEventListener("mousedown",e)}}),[a]);const _=[{key:"remove",label:(0,c.createElement)("a",{onClick:e=>{e.stopPropagation(),l(e,n)}},(0,E.__)("Remove","content-restriction"))},{key:"change",label:(0,c.createElement)("a",{onClick:e=>{e.stopPropagation(),i(e,n)}},(0,E.__)("Change","content-restriction"))}],m=r===n;return(0,c.createElement)("div",{ref:s},(0,c.createElement)(I.A,{menu:{items:_},trigger:["click"],placement:"bottomRight",open:!t&&m,onOpenChange:()=>{a(n)}},(0,c.createElement)("button",{className:"content-restriction__single__btn__action",onClick:e=>{e.stopPropagation(),t?i(e,n):a(n)}},t?(0,c.createElement)(v.A,null):(0,c.createElement)(y.A,null))))}const C="data:image/svg+xml;base64,PHN2ZyBmaWxsPSJub25lIiBoZWlnaHQ9IjQ4IiB2aWV3Qm94PSIwIDAgNDAgNDgiIHdpZHRoPSI0MCIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48cGF0aCBjbGlwLXJ1bGU9ImV2ZW5vZGQiIGQ9Im0yMCA0NGMxMS4wNDU3IDAgMjAtOC45NTQzIDIwLTIwcy04Ljk1NDMtMjAtMjAtMjBjLTExLjA0NTcyIDAtMjAgOC45NTQzLTIwIDIwczguOTU0MjggMjAgMjAgMjB6bTYuMjM5My0zMC42ODMyYy4zMDM3LTEuMDc4Ny0uNzQzMi0xLjcxNjctMS42OTkzLTEuMDM1NWwtMTMuMzQ2OSA5LjUwODNjLTEuMDM2OS43Mzg3LS44NzM4IDIuMjEwNC4yNDUgMi4yMTA0aDMuNTE0NnYtLjAyNzJoNi44NDk4bC01LjU4MTMgMS45NjkzLTIuNDYwNSA4Ljc0MTFjLS4zMDM3IDEuMDc4OC43NDMxIDEuNzE2NyAxLjY5OTMgMS4wMzU1bDEzLjM0NjktOS41MDgyYzEuMDM2OS0uNzM4Ny44NzM3LTIuMjEwNS0uMjQ1LTIuMjEwNWgtNS4zMjk4eiIgZmlsbD0iIzE1NWVlZiIgZmlsbC1ydWxlPSJldmVub2RkIi8+PC9zdmc+";var T=n(7072);const j=()=>(0,c.createElement)(c.Fragment,null,(0,c.createElement)("li",{className:"content-restriction__type__item"},(0,c.createElement)("button",{className:"content-restriction__type__btn"},(0,c.createElement)(T.A,{active:!0,paragraph:{rows:4}}))),(0,c.createElement)("li",{className:"content-restriction__type__item"},(0,c.createElement)("button",{className:"content-restriction__type__btn"},(0,c.createElement)(T.A,{active:!0,paragraph:{rows:4}}))),(0,c.createElement)("li",{className:"content-restriction__type__item"},(0,c.createElement)("button",{className:"content-restriction__type__btn"},(0,c.createElement)(T.A,{active:!0,paragraph:{rows:4}}))),(0,c.createElement)("li",{className:"content-restriction__type__item"},(0,c.createElement)("button",{className:"content-restriction__type__btn"},(0,c.createElement)(T.A,{active:!0,paragraph:{rows:4}}))),(0,c.createElement)("li",{className:"content-restriction__type__item"},(0,c.createElement)("button",{className:"content-restriction__type__btn"},(0,c.createElement)(T.A,{active:!0,paragraph:{rows:4}}))),(0,c.createElement)("li",{className:"content-restriction__type__item"},(0,c.createElement)("button",{className:"content-restriction__type__btn"},(0,c.createElement)(T.A,{active:!0,paragraph:{rows:4}})))),D=()=>{const e=(0,s.select)("content-restriction-stores"),[t,n]=(0,o.useState)(e.getRuleType()||"who-can-see"),[r,a]=(0,o.useState)([]),[i,l]=(0,o.useState)(!1),[_,m]=(0,o.useState)(e.getModal()||!1),[d,h]=(0,o.useState)("-"),[p,M]=(0,o.useState)("-"),N=(0,s.subscribe)((()=>{const t=e.getModal(),c=e.getRuleType();m(t),n(c),"restrict-view"===c&&(h((0,E.__)("How should the content be protected?","content-restriction")),M((0,E.__)("When user does not have access permission, the following options help control their experience.","content-restriction"))),"what-content"===c&&(h((0,E.__)("What content will be unlocked?","content-restriction")),M((0,E.__)("When user have access permission, the following content will be available.","content-restriction"))),"who-can-see"===c&&(h((0,E.__)("Who can see the content?","content-restriction")),M((0,E.__)("Which user type should be allowed to see the content.","content-restriction")))}));(0,o.useEffect)((()=>(m(e.getModal()),()=>N())));const b=()=>{m(e.getModal());const n=e.getWhatContent(),c=e.getWhoCanSee(),r=e.getRestrictView();t&&g(`content-restriction/modules/${t}`,{what_content:n?.key,who_can_see:c?.key,restrict_view:r?.key}).then((e=>{a(e),l(!0)}))};(0,o.useEffect)((()=>{b(),l(!1)}),[t]),(0,o.useEffect)((()=>{b()}),[]);const w=()=>{(0,s.dispatch)(u).setModalVisible(!1)};return(0,c.createElement)("div",{className:"content-restriction__modal "+(_?"content-restriction__modal--visible":"")},(0,c.createElement)("div",{className:"content-restriction__modal__overlay",onClick:w}),(0,c.createElement)("div",{className:"content-restriction__modal__content"},(0,c.createElement)("div",{className:"content-restriction__modal__content__header"},(0,c.createElement)("div",{className:"content-restriction__modal__content__header__info"},(0,c.createElement)("div",{class:"info-text"},(0,c.createElement)("h2",{class:"content-restriction__modal__content__title"},d),(0,c.createElement)("p",{class:"content-restriction__modal__content__desc"},p))),(0,c.createElement)("div",{className:"content-restriction__modal__content__header__action"},(0,c.createElement)("button",{className:"content-restriction__modal__content__close-btn",onClick:w},"x"))),(0,c.createElement)("div",{className:"content-restriction__modal__content__body"},(0,c.createElement)("div",{className:"content-restriction__modal__content__wrapper"},(0,c.createElement)("div",{className:"content-restriction__module"},r.length>0?(0,c.createElement)(c.Fragment,null,(0,c.createElement)("ul",{className:"content-restriction__type"},i?r?.map(((n,r)=>(0,c.createElement)(c.Fragment,null,n.upcoming||n.is_pro&&!content_restriction_admin.pro_available?(0,c.createElement)("li",{className:"content-restriction__type__item pro-item",key:r},(0,c.createElement)("button",{className:"content-restriction__type__btn",title:n.is_pro?(0,E.__)("Upgrade Now","content-restriction"):(0,E.__)("Upcoming","content-restriction")},n.upcoming?(0,c.createElement)("span",{class:"upcoming-badge"},(0,E.__)("Upcoming","content-restriction")):"",n.is_pro?(0,c.createElement)("span",{class:"pro-badge"},(0,c.createElement)("svg",{width:"20",height:"20",viewBox:"0 0 12 12",fill:"none",xmlns:"http://www.w3.org/2000/svg"},(0,c.createElement)("g",{"clip-path":"url(#clip0_457_540)"},(0,c.createElement)("path",{d:"M12 3.06766C12 2.40317 11.4594 1.86264 10.795 1.86264C10.1305 1.86264 9.58997 2.40317 9.58997 3.06766C9.58997 3.61594 9.61278 4.33792 9.16941 4.66046L8.70365 4.9993C8.219 5.35188 7.53519 5.20188 7.24262 4.67881L7.01772 4.27675C6.7391 3.77861 7.00523 3.12326 7.14059 2.56878C7.16295 2.47719 7.1748 2.38153 7.1748 2.28314C7.1748 1.61865 6.63428 1.07812 5.96979 1.07812C5.3053 1.07812 4.76477 1.61865 4.76477 2.28314C4.76477 2.39417 4.77986 2.50174 4.80809 2.6039C4.95811 3.1467 5.23419 3.78222 4.97543 4.2824L4.80172 4.61819C4.51816 5.16632 3.81066 5.32929 3.31588 4.96046L2.82316 4.59317C2.37951 4.26245 2.41013 3.53404 2.41013 2.98068C2.41013 2.31619 1.8696 1.77567 1.20511 1.77567C0.540527 1.77567 0 2.31619 0 2.98068C0 3.33173 0.150933 3.64809 0.391293 3.86846C0.666239 4.12054 0.977007 4.37886 1.06625 4.74104L2.29778 9.73924C2.40786 10.186 2.80861 10.5 3.26874 10.5H8.80645C9.26982 10.5 9.6725 10.1817 9.77945 9.73081L10.9414 4.83229C11.028 4.46732 11.3394 4.20557 11.6143 3.95037C11.8514 3.73024 12 3.41603 12 3.06766Z",fill:"#F17D0E"})),(0,c.createElement)("defs",null,(0,c.createElement)("clipPath",{id:"clip0_457_540"},(0,c.createElement)("rect",{width:"12",height:"12",fill:"white"}))))):"",(0,c.createElement)("img",{src:n?.icon||C,alt:n.name}),(0,c.createElement)("h3",null,n.name),(0,c.createElement)("span",null,n.desc))):(0,c.createElement)("li",{className:"content-restriction__type__item",key:r},(0,c.createElement)("button",{className:"content-restriction__type__btn",onClick:()=>((t,n)=>{(0,s.dispatch)(u).setModalVisible(!1),(0,s.dispatch)(u).setSidebarVisible(!0),(0,s.dispatch)(u).setRuleType(t);const c={...e.getRuleData(),[t]:n.key};(0,s.dispatch)(u).setRule(c),"who-can-see"===t?(0,s.dispatch)(u).setWhoCanSee(n):"what-content"===t?(0,s.dispatch)(u).setWhatContent(n):"restrict-view"===t&&(0,s.dispatch)(u).setRestrictView(n)})(t,n)},(0,c.createElement)("img",{src:n?.icon||C,alt:n.name}),(0,c.createElement)("h3",null,n.name),(0,c.createElement)("span",null,n.desc)))))):(0,c.createElement)(j,null))):"")))))};var f=n(3303),z=n(6190),A=n(1575);function k(e){return"string"!=typeof e?"":e.replace(/[^a-zA-Z0-9]/g," ").split(/[\s_]+/).map((e=>e.charAt(0).toUpperCase()+e.slice(1))).join(" ")}function R(e){return Object.entries(e||{}).map((([e,t])=>({value:e,label:"string"==typeof t?t:t.title})))}const{TextArea:L}=f.A,x=()=>{const[e,t]=(0,o.useState)(!1),[n,r]=(0,o.useState)("Action"),[a,i]=(0,o.useState)(),[l,_]=(0,o.useState)(!1),[m,d]=(0,o.useState)(!1),[h,p]=(0,o.useState)(null),[g,M]=(0,o.useState)([]),[N,b]=(0,o.useState)(null),[w,y]=(0,o.useState)({}),[v,I]=(0,o.useState)("");(0,o.useEffect)((()=>{const e=(0,s.select)("content-restriction-stores");_(e.getSidebar());const n=(0,s.subscribe)((()=>{const n=e.getSidebar(),c=e.getRuleType(),a=e.getRuleData(),l=e.getWhoCanSee(),s=e.getWhatContent(),o=e.getRestrictView();_(n),t(c),y(a),"who-can-see"===c?(i(l),r(l.name)):"what-content"===c?(i(s),r(s.name)):"restrict-view"===c&&(i(o),r(o.name))}));return()=>n()}));const S=(t,n)=>{y((c=>({...c,[e]:{[a.key]:{...c[e]?.[a.key],[t]:n}}})))};return(0,o.useEffect)((()=>{const e=w&&w["what-content"];if(e&&"object"==typeof e)for(const[t,n]of Object.entries(e))I(t);else I(e);(0,s.dispatch)(u).setRule(w)}),[w]),(0,o.useEffect)((()=>{if(p(null),M(null),b(null),a&&!a?.options)y((t=>({...t,[e]:a?.key})));else if(a&&e&&w&&w[e]?.[a.key]){const t=w[e][a.key];if("string"==typeof t||"number"==typeof t)p(t),M([]),b([]);else if("object"==typeof t){const e=Object.keys(t)[0];if(p(e),Array.isArray(t[e])){b(t[e]);const n=a.options[e];if(n&&"multi-select"===n.type){const e=Object.entries(n.options||{}).map((([e,t])=>({value:e,label:t})));M(e)}}else M([]),b([])}}else y((t=>({...t,[e]:a?.key})))}),[a]),(0,c.createElement)("div",{className:"content-restriction__sidebar "+(l?"content-restriction__sidebar--visible":"")},a?(0,c.createElement)("div",{className:"content-restriction__sidebar__content"},(0,c.createElement)("div",{className:"content-restriction__sidebar__content__header"},(0,c.createElement)("h2",{className:"content-restriction__sidebar__content__title"},n),(0,c.createElement)("button",{className:"content-restriction__sidebar__content__btn",onClick:e=>(e=>{e.stopPropagation(),(0,s.dispatch)(u).setSidebarVisible(!1),(0,s.dispatch)(u).setModalVisible(!0)})(e)},(0,E.__)("Change","content-restriction")),(0,c.createElement)("button",{className:"content-restriction__sidebar__content__close-btn",onClick:()=>{(0,s.dispatch)(u).setSidebarVisible(!1)}},"x")),(0,c.createElement)("div",{className:"content-restriction__sidebar__content__body"},(0,c.createElement)("div",{className:"content-restriction__sidebar__tab"},(0,c.createElement)("div",{className:"tab-content content-restriction__sidebar__tab__content",id:"nav-tabContent"},(0,c.createElement)("div",{className:"content-restriction__sidebar__tab__content__event"},(0,c.createElement)("div",{className:"content-restriction__sidebar__tab__content__event__wrapper"},"select"===a?.type?(0,c.createElement)(c.Fragment,null,(0,c.createElement)("h3",{className:"content-restriction__sidebar__tab__content__event__title"},(0,E.__)("Select ","content-restriction")," ",a?.name,"   ",(0,E.__)("(required) ","content-restriction")),(0,c.createElement)(z.A,{allowClear:!0,style:{width:"100%",marginBottom:"10px"},placeholder:(0,E.__)("Please select an option","content-restriction"),onChange:t=>{const n=a.options[t];if(p(t),b([]),n&&"object"==typeof n&&"multi-select"===n.type){const c=Object.entries(n.options||{}).map((([e,t])=>({value:e,label:t})));M(c),y((n=>({...n,[e]:{[a.key]:{[t]:[]}}})))}else n?(M([]),y((n=>({...n,[e]:{[a.key]:t}})))):M([])},options:R(a?.options),value:h}),h&&g.length>0&&(0,c.createElement)(c.Fragment,null,(0,c.createElement)("h3",{className:"content-restriction__sidebar__tab__content__event__title"}," ",(0,E.__)("Choose","content-restriction")," ",k(h)),(0,c.createElement)(z.A,{mode:"multiple",allowClear:!0,style:{width:"100%"},placeholder:`Select ${h} option`,onChange:t=>{b(t),y((n=>({...n,[e]:{[a.key]:{[h]:t}}})))},options:g,value:N}))):"section"===a?.type?(0,c.createElement)(c.Fragment,null,a.options&&Object.entries(a.options).length>0?Object.entries(a.options).map((([t,n])=>"text"===n.type||"url"===n.type?(0,c.createElement)("div",{className:"content-restriction__sidebar__tab__content__event__section-wrapper",key:t},(0,c.createElement)("h3",{className:"content-restriction__sidebar__tab__content__event__title"},n.title),(0,c.createElement)(f.A,{id:`content-restriction__${t}`,placeholder:`Type ${n.title}`,value:w&&w[e]?.[a.key]?.[t]||"",onChange:e=>S(t,e.target.value)})):"textarea"===n.type?(0,c.createElement)("div",{className:"content-restriction__sidebar__tab__content__event__section-wrapper",key:t},(0,c.createElement)("h3",{className:"content-restriction__sidebar__tab__content__event__title"},n.title),(0,c.createElement)(L,{id:`content-restriction__${t}`,rows:4,placeholder:`Type ${n.title}`,value:w&&w[e]?.[a.key]?.[t]||"",onChange:e=>S(t,e.target.value)})):"range"===n.type?(0,c.createElement)("div",{className:"content-restriction__sidebar__tab__content__event__section-wrapper",key:t},(0,c.createElement)("h3",{className:"content-restriction__sidebar__tab__content__event__title"},n.title),(0,c.createElement)(A.A,{defaultValue:n.default,value:w&&w[e]?.[a.key]?.[t]||n.default,onChange:e=>S(t,e)})):"multi-select"===n.type?(0,c.createElement)("div",{className:"content-restriction__sidebar__tab__content__event__section-wrapper",key:t},(0,c.createElement)("h3",{className:"content-restriction__sidebar__tab__content__event__title"},n.title),(0,c.createElement)(z.A,{mode:"multiple",allowClear:!0,style:{width:"100%"},placeholder:(0,E.__)("Please select","content-restriction"),onChange:e=>S(t,e),options:R(n.options),value:w&&w[e]?.[a.key]?.[t]||[]})):null)):(0,c.createElement)("div",null,(0,E.__)("No options available","content-restriction"))):(0,c.createElement)(c.Fragment,null,(0,c.createElement)("p",{className:"content-restriction__sidebar__tab__content__event__desc"},a?.desc)))))))):null)},O=()=>(0,c.createElement)(c.Fragment,null,(0,c.createElement)("div",{className:"content-restriction__single__btn"},(0,c.createElement)(T.A,{active:!0,title:!1,paragraph:{rows:1,width:"100%"}})));function V(){const[e,t]=(0,o.useState)(null),[n,r]=(0,o.useState)([]),[a,i]=(0,o.useState)(""),[l,_]=(0,o.useState)(""),[m,d]=(0,o.useState)(""),[h,p]=(0,o.useState)(null),[M,N]=(0,o.useState)(!1),[b,w]=(0,o.useState)(C),[y,v]=(0,o.useState)(C),[I,T]=(0,o.useState)(C),j={name:"",key:"",type:"",options:""};(0,o.useEffect)((()=>{const e=window.location.href.split("/"),n=e[e.length-1];if("rule"===n)return N(!0),(0,s.dispatch)(u).setWhoCanSee(j),(0,s.dispatch)(u).setWhatContent(j),(0,s.dispatch)(u).setRestrictView(j),(0,s.dispatch)(u).setRuleTitle(""),(0,s.dispatch)(u).setRulePublished(""),(0,s.dispatch)(u).setId(""),void(0,s.dispatch)(u).setRule("");t(e[6]),g("content-restriction/rules/list").then((e=>{r(e);const t=e.length>0&&e.find((e=>e.id===n));(0,s.dispatch)(u).setId(t?.id),(0,s.dispatch)(u).setRule(t?.rule),(0,s.dispatch)(u).setRulePublished(t?.status),(0,s.dispatch)(u).setRuleTitle(t?.title);const c=t&&t?.rule["who-can-see"]?"object"==typeof t?.rule["who-can-see"]?Object.keys(t?.rule["who-can-see"])[0]:"string"==typeof t?.rule["who-can-see"]?t?.rule["who-can-see"]:"":"",a=t&&t?.rule["what-content"]?"object"==typeof t?.rule["what-content"]?Object.keys(t?.rule["what-content"])[0]:"string"==typeof t?.rule["what-content"]?t?.rule["what-content"]:"":"",l=t&&t?.rule["restrict-view"]?"object"==typeof t?.rule["restrict-view"]?Object.keys(t?.rule["restrict-view"])[0]:"string"==typeof t?.rule["restrict-view"]?t?.rule["restrict-view"]:"":"";i(k(c)),_(k(a)),d(k(l));const o=async(e,t)=>{try{const n=(e&&await g(`content-restriction/modules/${e}`)).find((e=>e.key===t));n&&("who-can-see"===e?(0,s.dispatch)(u).setWhoCanSee(n):"what-content"===e?(0,s.dispatch)(u).setWhatContent(n):"restrict-view"===e&&(0,s.dispatch)(u).setRestrictView(n))}catch(e){}};o("who-can-see",c),o("what-content",a),o("restrict-view",l),N(!0)})).catch((e=>{}))}),[]),(0,o.useEffect)((()=>{const e=(0,s.select)("content-restriction-stores"),t=(0,s.subscribe)((()=>{var t,n,c;const r=e.getWhoCanSee(),a=e.getWhatContent(),l=e.getRestrictView();i(r.name),_(a.name),d(l.name),w(null!==(t=r.icon)&&void 0!==t?t:b),v(null!==(n=a.icon)&&void 0!==n?n:y),T(null!==(c=l.icon)&&void 0!==c?c:I)}));return()=>t()}),[n]);const f=(e,t)=>{e.stopPropagation(),(0,s.dispatch)(u).setRuleType(t),"who-can-see"===t?a?A():z():"what-content"===t?l?A():z():"restrict-view"===t&&(m?A():z())},z=()=>{p(null),(0,s.dispatch)(u).setModalVisible(!0)},A=()=>{p(null),(0,s.dispatch)(u).setSidebarVisible(!0)},R=(e,t)=>{e.stopPropagation(),(0,s.dispatch)(u).setModalVisible(!1),(0,s.dispatch)(u).setSidebarVisible(!1),"who-can-see"===t?(i(""),(0,s.dispatch)(u).setWhoCanSee(j)):"what-content"===t?(_(""),(0,s.dispatch)(u).setWhatContent(j)):"restrict-view"===t&&(d(""),(0,s.dispatch)(u).setRestrictView(j))},L=(e,t)=>{e.stopPropagation(),p(null),(0,s.dispatch)(u).setRuleType(t),(0,s.dispatch)(u).setModalVisible(!0)};return(0,c.createElement)(c.Fragment,null,(0,c.createElement)("section",{className:"content-restriction__create-rules"},M?(0,c.createElement)(c.Fragment,null,(0,c.createElement)("div",{className:"content-restriction__single"},(0,c.createElement)("div",{className:"content-restriction__single__btn",onClick:e=>f(e,"who-can-see")},(0,c.createElement)("img",{src:b}),a?(0,c.createElement)(c.Fragment,null,(0,c.createElement)("h3",{className:"content-restriction__single__btn__title"},a),(0,c.createElement)(S,{id:e,type:"who-can-see",openKey:h,setOpenKey:p,changeAction:L,resetType:R})):(0,c.createElement)("h3",{className:"content-restriction__single__btn__title"},(0,E.__)("Who can see the content?","content-restriction")))),(0,c.createElement)("div",{className:"content-restriction__single"},(0,c.createElement)("div",{className:"content-restriction__single__btn "+(a?"":"disabled"),onClick:e=>f(e,"what-content")},(0,c.createElement)("img",{src:y}),l?(0,c.createElement)(c.Fragment,null,(0,c.createElement)("h3",{className:"content-restriction__single__btn__title"},l),(0,c.createElement)(S,{id:e,type:"what-content",openKey:h,setOpenKey:p,changeAction:L,resetType:R})):(0,c.createElement)("h3",{className:"content-restriction__single__btn__title"},(0,E.__)("What content will be unlocked?","content-restriction")))),(0,c.createElement)("div",{className:"content-restriction__single"},(0,c.createElement)("div",{className:"content-restriction__single__btn "+(a&&l?"":"disabled"),onClick:e=>f(e,"restrict-view")},(0,c.createElement)("img",{src:I}),m?(0,c.createElement)(c.Fragment,null,(0,c.createElement)("h3",{className:"content-restriction__single__btn__title"},m),(0,c.createElement)(S,{id:e,type:"restrict-view",openKey:h,setOpenKey:p,changeAction:L,resetType:R})):(0,c.createElement)("h3",{className:"content-restriction__single__btn__title"},(0,E.__)("How should the content be protected?","content-restriction"))))):(0,c.createElement)(c.Fragment,null,(0,c.createElement)(O,null),(0,c.createElement)(O,null),(0,c.createElement)(O,null))),(0,c.createElement)(D,null),(0,c.createElement)(x,null))}function W(){return(0,c.createElement)(c.Fragment,null,(0,c.createElement)(w,null),(0,c.createElement)(V,null))}var U=n(9266);const P=[{key:"rules",label:(0,c.createElement)(r.N_,{to:"/rules",className:"content-restriction__menu__single"},(0,E.__)("Rules","content-restriction"))},{key:"integrations",label:(0,c.createElement)(r.N_,{to:"/integrations",className:"content-restriction__menu__single"},(0,E.__)("Integrations","content-restriction"))},{key:"license",label:content_restriction_admin.pro_available?"":(0,c.createElement)("a",{href:"https://contentrestriction.com/pricing/?utm_source=wp-plugins&utm_campaign=upgrade-to-pro&utm_medium=wp-dash",target:"_blank",className:"upgrade-to-pro"},(0,c.createElement)("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",xmlns:"http://www.w3.org/2000/svg"},(0,c.createElement)("g",{"clip-path":"url(#clip0_457_540)"},(0,c.createElement)("path",{d:"M12 3.06766C12 2.40317 11.4594 1.86264 10.795 1.86264C10.1305 1.86264 9.58997 2.40317 9.58997 3.06766C9.58997 3.61594 9.61278 4.33792 9.16941 4.66046L8.70365 4.9993C8.219 5.35188 7.53519 5.20188 7.24262 4.67881L7.01772 4.27675C6.7391 3.77861 7.00523 3.12326 7.14059 2.56878C7.16295 2.47719 7.1748 2.38153 7.1748 2.28314C7.1748 1.61865 6.63428 1.07812 5.96979 1.07812C5.3053 1.07812 4.76477 1.61865 4.76477 2.28314C4.76477 2.39417 4.77986 2.50174 4.80809 2.6039C4.95811 3.1467 5.23419 3.78222 4.97543 4.2824L4.80172 4.61819C4.51816 5.16632 3.81066 5.32929 3.31588 4.96046L2.82316 4.59317C2.37951 4.26245 2.41013 3.53404 2.41013 2.98068C2.41013 2.31619 1.8696 1.77567 1.20511 1.77567C0.540527 1.77567 0 2.31619 0 2.98068C0 3.33173 0.150933 3.64809 0.391293 3.86846C0.666239 4.12054 0.977007 4.37886 1.06625 4.74104L2.29778 9.73924C2.40786 10.186 2.80861 10.5 3.26874 10.5H8.80645C9.26982 10.5 9.6725 10.1817 9.77945 9.73081L10.9414 4.83229C11.028 4.46732 11.3394 4.20557 11.6143 3.95037C11.8514 3.73024 12 3.41603 12 3.06766Z",fill:"#F17D0E"})),(0,c.createElement)("defs",null,(0,c.createElement)("clipPath",{id:"clip0_457_540"},(0,c.createElement)("rect",{width:"12",height:"12",fill:"white"})))),(0,E.__)("Upgrade Now","content-restriction"))}];function H({menuKey:e}){return(0,c.createElement)(U.A,{selectedKeys:[e],mode:"horizontal",items:P,lineWidth:"0",style:{width:"100%",lineHeight:"70px"}})}function Q({menuKey:e}){return(0,c.createElement)(c.Fragment,null,(0,c.createElement)("div",{className:"content-restriction__header"},(0,c.createElement)("div",{className:"content-restriction__header__action content-restriction__header__action--left"},(0,c.createElement)(r.N_,{to:"/",className:"content-restriction__menu__single"},(0,c.createElement)("img",{src:"data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSI0MyIgaGVpZ2h0PSI0MyIgdmlld0JveD0iMCAwIDQzIDQzIiBmaWxsPSJub25lIj4KPHBhdGggZD0iTTAgM0MwIDEuMzQzMTQgMS4zNDMxNSAwIDMgMEg0MEM0MS42NTY5IDAgNDMgMS4zNDMxNSA0MyAzVjQwQzQzIDQxLjY1NjkgNDEuNjU2OSA0MyA0MCA0M0gzQzEuMzQzMTQgNDMgMCA0MS42NTY5IDAgNDBWM1oiIGZpbGw9IiMzNzQ3RDYiLz4KPHBhdGggZD0iTTEyLjM5MDkgMTMuNjYzSDEzLjU0MTkiIHN0cm9rZT0id2hpdGUiIHN0cm9rZS13aWR0aD0iMS41IiBzdHJva2UtbGluZWNhcD0icm91bmQiIHN0cm9rZS1saW5lam9pbj0icm91bmQiLz4KPHBhdGggZD0iTTE2LjY1NDggMTMuNjYzSDI3LjE5NTMiIHN0cm9rZT0id2hpdGUiIHN0cm9rZS13aWR0aD0iMS41IiBzdHJva2UtbGluZWNhcD0icm91bmQiIHN0cm9rZS1saW5lam9pbj0icm91bmQiLz4KPHBhdGggZD0iTTE2LjM2NjkgMjkuNDI5NUMxNi4zNjY5IDI4LjM5OTUgMTYuMzY2OSAyNy45MTE2IDE2LjcxMjMgMjcuNTg2NEMxNy4wNTc2IDI3LjI2MTEgMTcuNTc1NiAyNy4yNjExIDE4LjY2OTEgMjcuMjYxMUgyMy4yNzM0QzI0LjM2NjkgMjcuMjYxMSAyNC44ODQ5IDI3LjI2MTEgMjUuMjMwMyAyNy41ODY0QzI1LjU3NTYgMjcuOTExNiAyNS41NzU2IDI4LjM5OTUgMjUuNTc1NiAyOS40Mjk1VjMwLjUxMzdDMjUuNTc1NiAzMi4wMzE1IDI1LjU3NTYgMzIuNzkwNSAyNS4wNTc2IDMzLjI3ODNDMjQuNTM5NiAzMy43NjYyIDIzLjczMzggMzMuNzY2MiAyMi4xMjIzIDMzLjc2NjJIMTkuODIwMkMxOC4yMDg3IDMzLjc2NjIgMTcuNDAyOSAzMy43NjYyIDE2Ljg4NDkgMzMuMjc4M0MxNi4zNjY5IDMyLjc5MDUgMTYuMzY2OSAzMi4wMzE1IDE2LjM2NjkgMzAuNTEzN1YyOS40Mjk1WiIgc3Ryb2tlPSIjRkZFNUQ2IiBzdHJva2Utd2lkdGg9IjEuNSIgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIi8+CjxwYXRoIGQ9Ik0yMy4yNzMzIDI2LjcxOTFWMjYuMTc3QzIzLjI3MzMgMjQuOTg0NCAyMi4yMzczIDI0LjAwODcgMjAuOTcxMSAyNC4wMDg3QzE5LjcwNDkgMjQuMDA4NyAxOC42Njg5IDI0Ljk4NDQgMTguNjY4OSAyNi4xNzdWMjYuNzE5MSIgc3Ryb2tlPSIjRkZFNUQ2IiBzdHJva2Utd2lkdGg9IjEuNSIgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIi8+CjxwYXRoIGQ9Ik0xMi42ODM1IDMyLjU1MTFDMTAuNjExNSAzMi4zMzQzIDkgMzAuNzA4IDkgMjguNzAyMlYxMy45MDMxQzkgMTEuNzM0NyAxMC44NDE3IDEwIDEzLjE0MzkgMTBIMjguODU2MUMzMS4xNTgzIDEwIDMzIDExLjczNDcgMzMgMTMuOTAzMVYyOC43MDIyQzMzIDMwLjcwOCAzMS4zODg1IDMyLjMzNDMgMjkuMzE2NSAzMi41NTExIiBzdHJva2U9IndoaXRlIiBzdHJva2Utd2lkdGg9IjIiIHN0cm9rZS1taXRlcmxpbWl0PSIxMCIgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIi8+CjxwYXRoIGQ9Ik05LjIzNDEzIDE2Ljc3NTZIMzIuNzA5MSIgc3Ryb2tlPSJ3aGl0ZSIgc3Ryb2tlLXdpZHRoPSIxLjUiIHN0cm9rZS1taXRlcmxpbWl0PSIxMCIgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIi8+Cjwvc3ZnPg==",alt:"{__( 'Content Restriction', 'content-restriction' )}"})),(0,c.createElement)("div",{className:"content-restriction__menu__single__name"},(0,c.createElement)("span",null,"All-in-One"),(0,c.createElement)("span",{className:"content-restriction__menu__single__name__highlight"},(0,E.__)("Content Restriction","content-restriction")))),(0,c.createElement)("div",{className:"content-restriction__header__action content-restriction__header__action--right"},(0,c.createElement)(H,{menuKey:e}))))}var Y=n(2609),Z=n(6795);function B({timestamp:e}){return F(1e3*e)}const F=e=>{const t=new Date,n=new Date(e),c=Math.floor((t-n)/1e3);let r=Math.floor(c/31536e3);return r>=1?1===r?(0,E.__)(" 1 year ago","content-restriction"):r+(0,E.__)(" years ago","content-restriction"):(r=Math.floor(c/2592e3),r>=1?1===r?(0,E.__)(" 1 month ago","content-restriction"):r+(0,E.__)(" months ago","content-restriction"):(r=Math.floor(c/86400),r>=1?1===r?(0,E.__)(" 1 day ago","content-restriction"):r+(0,E.__)(" days ago","content-restriction"):(r=Math.floor(c/3600),r>=1?1===r?(0,E.__)(" 1 hour ago","content-restriction"):r+(0,E.__)(" hours ago","content-restriction"):(r=Math.floor(c/60),r>=1?1===r?(0,E.__)(" 1 minute ago","content-restriction"):r+(0,E.__)(" minutes ago","content-restriction"):1===Math.floor(c)?(0,E.__)(" 1 second ago","content-restriction"):Math.floor(c)+(0,E.__)(" seconds ago","content-restriction")))))},G=()=>(0,c.createElement)(c.Fragment,null,(0,c.createElement)("tr",null,(0,c.createElement)("td",null,(0,c.createElement)(T.A,{active:!0,title:!1,paragraph:{rows:1,width:"100%"}})),(0,c.createElement)("td",null,(0,c.createElement)(T.A,{active:!0,title:!1,paragraph:{rows:1,width:"100%"}})),(0,c.createElement)("td",null,(0,c.createElement)(T.A,{active:!0,title:!1,paragraph:{rows:1,width:"100%"}})),(0,c.createElement)("td",null,(0,c.createElement)(T.A,{active:!0,title:!1,paragraph:{rows:1,width:"100%"}}))));function J(){const e=(0,a.Zp)(),[t,n]=(0,o.useState)([]),[i,l]=(0,o.useState)({}),[s,_]=(0,o.useState)(!1);return(0,o.useEffect)((()=>{const e=t.reduce(((e,t)=>(e[t.id]=t.status,e)),{});l(e)}),[t]),(0,o.useEffect)((()=>{g("content-restriction/rules/list").then((e=>{n(e),_(!0)})).catch((e=>{b("error",(0,E.__)("Something wen't wrong!","content-restriction"))}))}),[]),(0,c.createElement)("div",{class:"content-restriction__rules relative"},(0,c.createElement)("table",{class:"content-restriction__rules__list"},(0,c.createElement)("thead",{class:"content-restriction__rules__list__header"},(0,c.createElement)("tr",null,(0,c.createElement)("th",{scope:"col",width:"5%"},(0,E.__)("Status","content-restriction")),(0,c.createElement)("th",{scope:"col"},(0,E.__)("Name","content-restriction")),(0,c.createElement)("th",{scope:"col"},(0,E.__)("Last edit","content-restriction")),(0,c.createElement)("th",{scope:"col",width:"5%",className:"text-center"},(0,E.__)("Actions","content-restriction")))),(0,c.createElement)("tbody",{class:"content-restriction__rules__body"},t.length>0?t.map(((t,n)=>(0,c.createElement)("tr",{key:n},(0,c.createElement)("td",null,(0,c.createElement)(Y.A,{checked:i[t.id],onChange:e=>((e,t,n,c)=>{l({...i,[t]:e}),g("content-restriction/rules/update",{id:t,data:{status:e,title:n,rule:c}}).then((e=>{b("success",(0,E.__)("Successfully updated!","content-restriction"))})).catch((e=>{b("error",(0,E.__)("Status update error","content-restriction"))}))})(e,t.id,t.title,t.rule),checkedChildren:"",unCheckedChildren:""})),(0,c.createElement)("td",null,(0,c.createElement)(r.N_,{to:`/rule/${t.id}`},t.title)),(0,c.createElement)("td",null,(0,c.createElement)(B,{timestamp:t.modified})),(0,c.createElement)("td",{className:"content-restriction__rules__action"},(0,c.createElement)(Z.A,{title:(0,E.__)("Delete","content-restriction")},(0,c.createElement)("a",{href:"#",className:"delete-btn"},(0,c.createElement)("svg",{onClick:()=>{return n=t.id,c=e,void M({title:(0,E.__)("Are you sure you want to delete this item?","content-restriction"),content:(0,E.__)("This action cannot be undone.","content-restriction"),okText:(0,E.__)("Confirm","content-restriction"),okType:"danger",cancelText:(0,E.__)("Cancel","content-restriction"),onOk(){((e,t)=>{g(`content-restriction/rules/delete?id=${e}`).then((e=>{t("/rules"),window.location.reload()})).catch((e=>{}))})(n,c)},onCancel(){}});var n,c},width:"13",height:"18",viewBox:"0 0 304 384",xmlns:"http://www.w3.org/2000/svg"},(0,c.createElement)("path",{fill:"#CA0B00",d:"M21 341V85h256v256q0 18-12.5 30.5T235 384H64q-18 0-30.5-12.5T21 341M299 21v43H0V21h75L96 0h107l21 21z"})))),(0,c.createElement)(Z.A,{title:"Edit"},(0,c.createElement)(r.N_,{to:`/rule/${t.id}`},(0,c.createElement)("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",height:"24",width:"24",size:"24",name:"actionEdit"},(0,c.createElement)("path",{fill:"#2D2E2E",d:"m16.92 5 3.51 3.52 1.42-1.42-4.93-4.93L3 16.09V21h4.91L19.02 9.9 17.6 8.48 7.09 19H5v-2.09L16.92 5Z"})))))))):s?(0,c.createElement)("tr",null,(0,c.createElement)("td",{colSpan:"4",className:"text-center"},(0,E.__)("No rules was found! Create new rule","content-restriction"))):(0,c.createElement)(c.Fragment,null,(0,c.createElement)(G,null),(0,c.createElement)(G,null),(0,c.createElement)(G,null)))))}function K(){return(0,c.createElement)(c.Fragment,null,(0,c.createElement)(Q,{menuKey:"rules"}),(0,c.createElement)("div",{className:"content-restriction__rules container"},(0,c.createElement)("div",{className:"content-restriction__rules__header"},(0,c.createElement)("h1",{className:"content-restriction__rules__header__title"},"Rules"),(0,c.createElement)(r.N_,{to:"/rule",className:"content-restriction__btn content-restriction__btn--create"},(0,c.createElement)("svg",{width:"15",height:"15",viewBox:"0 0 29 29",fill:"none",xmlns:"http://www.w3.org/2000/svg"},(0,c.createElement)("path",{d:"M15.2031 0.4375C15.5761 0.4375 15.9338 0.585658 16.1975 0.849381C16.4612 1.1131 16.6094 1.47079 16.6094 1.84375V12.3906H27.1562C27.5292 12.3906 27.8869 12.5388 28.1506 12.8025C28.4143 13.0662 28.5625 13.4239 28.5625 13.7969V15.2031C28.5625 15.5761 28.4143 15.9338 28.1506 16.1975C27.8869 16.4612 27.5292 16.6094 27.1562 16.6094H16.6094V27.1562C16.6094 27.5292 16.4612 27.8869 16.1975 28.1506C15.9338 28.4143 15.5761 28.5625 15.2031 28.5625H13.7969C13.4239 28.5625 13.0662 28.4143 12.8025 28.1506C12.5388 27.8869 12.3906 27.5292 12.3906 27.1562V16.6094H1.84375C1.47079 16.6094 1.1131 16.4612 0.849381 16.1975C0.585658 15.9338 0.4375 15.5761 0.4375 15.2031V13.7969C0.4375 13.4239 0.585658 13.0662 0.849381 12.8025C1.1131 12.5388 1.47079 12.3906 1.84375 12.3906H12.3906V1.84375C12.3906 1.47079 12.5388 1.1131 12.8025 0.849381C13.0662 0.585658 13.4239 0.4375 13.7969 0.4375H15.2031Z",fill:"white"})),(0,c.createElement)("span",null,(0,E.__)("Create Rule","content-restriction")))),(0,c.createElement)(J,null)))}const X=()=>(0,c.createElement)("div",{class:"content-restriction__integrations__list__item"},(0,c.createElement)("div",{class:"content-restriction__integrations__list__item__header"},(0,c.createElement)(T.A,{active:!0,title:!1,paragraph:{rows:8,width:"100%"}})));function $(){const[e,t]=(0,o.useState)([]),[n,r]=(0,o.useState)(!1);return(0,o.useEffect)((()=>{g("content-restriction/settings/integrations").then((e=>{t(e),r(!0)})).catch((e=>{b("error",(0,E.__)("Something wen't wrong!","content-restriction"))}))}),[]),(0,c.createElement)("div",{class:"content-restriction__integrations__list"},n?e.map(((e,t)=>(0,c.createElement)("div",{class:"content-restriction__integrations__list__item"},(0,c.createElement)("div",{class:"content-restriction__integrations__list__item__header"},(0,c.createElement)("img",{src:e.icon,alt:e.title}),(0,c.createElement)("div",{class:"badges"},e.badges.map(((e,t)=>(0,c.createElement)("span",{class:"badge"},k(e)))))),(0,c.createElement)("h3",{class:"content-restriction__integrations__list__item__title"},e.title),(0,c.createElement)("div",{class:"content-restriction__integrations__list__item__desc"},(0,c.createElement)("p",null,e.details)),(0,c.createElement)("p",{class:"content-restriction__integrations__list__item__actions"},e.link?(0,c.createElement)("a",{target:"__blank",href:e.link+"?utm_source=plugin&utm_medium=link&utm_campaign=integrations",class:"learn-more"},(0,E.__)("Learn more","content-restriction")):(0,c.createElement)("span",null),e.action&&"upgrade"===e.action?(0,c.createElement)("a",{href:"https://contentrestriction.com/pricing/?utm_source=wp-plugins&utm_campaign=upgrade-to-pro&utm_medium=wp-dash",class:"action upgrade-to-pro",target:"__blank"},(0,E.__)("Let's go","content-restriction")):"")))):(0,c.createElement)(c.Fragment,null,(0,c.createElement)(X,null),(0,c.createElement)(X,null),(0,c.createElement)(X,null),(0,c.createElement)(X,null),(0,c.createElement)(X,null),(0,c.createElement)(X,null),(0,c.createElement)(X,null),(0,c.createElement)(X,null),(0,c.createElement)(X,null),(0,c.createElement)(X,null)))}function q(){return(0,c.createElement)(c.Fragment,null,(0,c.createElement)(Q,{menuKey:"integrations"}),(0,c.createElement)("div",{className:"content-restriction__integrations container"},(0,c.createElement)("div",{className:"content-restriction__integrations__header"},(0,c.createElement)("h1",{className:"content-restriction__integrations__header__title"},(0,E.__)("Integrations","content-restriction")),(0,c.createElement)("p",null,(0,E.__)("Seamlessly integrate with other plugins to enhance your website’s content visibility and control functionality. Use advanced conditional rules to create a more personalized user experience.","content-restriction"))),(0,c.createElement)($,null)))}function ee(){return(0,c.createElement)(c.Fragment,null,(0,c.createElement)(w,null),(0,c.createElement)(V,null))}var te=n(5448);const{TextArea:ne}=f.A,{Option:ce}=z.A,{Sider:re,Content:ae}=te.A,{TextArea:ie}=f.A,le=function(){return(0,c.createElement)(c.Fragment,null,(0,c.createElement)(r.I9,null,(0,c.createElement)(a.BV,null,(0,c.createElement)(a.qh,{path:"/",element:(0,c.createElement)(K,null)}),(0,c.createElement)(a.qh,{path:"/rules",element:(0,c.createElement)(K,null)}),(0,c.createElement)(a.qh,{path:"/rule",element:(0,c.createElement)(W,null)}),(0,c.createElement)(a.qh,{path:"/rule/:id",element:(0,c.createElement)(ee,null)}),(0,c.createElement)(a.qh,{path:"/integrations",element:(0,c.createElement)(q,null)}))))}}}]);
     1"use strict";(globalThis.webpackChunkcontent_restriction=globalThis.webpackChunkcontent_restriction||[]).push([[704],{6704:(e,t,n)=>{n.r(t),n.d(t,{default:()=>se});var c=n(1609),r=n(4976),a=n(7767),i=n(6207),s=n(261),l=n(7143),o=n(6087);const _={modalVisible:!1,sidebarVisible:!1,ruleType:"",contentRule:{status:!1,id:"",ruleTitle:"",whoCanSee:{},whatContent:{},restrictView:{},ruleData:{}}},m=(0,l.createReduxStore)("content-restriction-stores",{reducer(e=(()=>_)(),t){let n;switch(t.type){case"SET_WHO_CAN_SEE":n={...e,contentRule:{...e.contentRule,whoCanSee:{...t.whoCanSee}}};break;case"SET_WHAT_CONTENT":n={...e,contentRule:{...e.contentRule,whatContent:{...t.whatContent}}};break;case"SET_RESTRICT_VIEW":n={...e,contentRule:{...e.contentRule,restrictView:{...t.restrictView}}};break;case"SET_RULE":n={...e,contentRule:{...e.contentRule,ruleData:t.rule}};break;case"SET_RULE_STATUS":n={...e,contentRule:{...e.contentRule,status:t.status}};break;case"SET_ID":n={...e,contentRule:{...e.contentRule,id:t.id}};break;case"SET_RULE_TITLE":n={...e,contentRule:{...e.contentRule,ruleTitle:t.ruleTitle}};break;case"SET_RULE_TYPE":n={...e,ruleType:t.ruleType};break;case"SET_MODAL_VISIBLE":n={...e,modalVisible:t.modalVisible};break;case"SET_SIDEBAR_VISIBLE":n={...e,sidebarVisible:t.sidebarVisible};break;default:n=e}return localStorage.setItem("content-restriction-stores",JSON.stringify(n)),n},actions:{setWhoCanSee:e=>({type:"SET_WHO_CAN_SEE",whoCanSee:e}),setWhatContent:e=>({type:"SET_WHAT_CONTENT",whatContent:e}),setRestrictView:e=>({type:"SET_RESTRICT_VIEW",restrictView:e}),setRule:e=>({type:"SET_RULE",rule:e}),setRulePublished:e=>({type:"SET_RULE_STATUS",status:e}),setId:e=>({type:"SET_ID",id:e}),setRuleTitle:e=>({type:"SET_RULE_TITLE",ruleTitle:e}),setRuleType:e=>({type:"SET_RULE_TYPE",ruleType:e}),setModalVisible:e=>({type:"SET_MODAL_VISIBLE",modalVisible:e}),setSidebarVisible:e=>({type:"SET_SIDEBAR_VISIBLE",sidebarVisible:e})},selectors:{getRuleData:e=>e.contentRule.ruleData,getRuleStatus:e=>e.contentRule.status,getId:e=>e.contentRule.id,getRuleTitle:e=>e.contentRule.ruleTitle,getWhoCanSee:e=>e.contentRule.whoCanSee,getWhatContent:e=>e.contentRule.whatContent,getRestrictView:e=>e.contentRule.restrictView,getRule:e=>e.contentRule,getRuleType:e=>e.ruleType,getModal:e=>e.modalVisible,getSidebar:e=>e.sidebarVisible}});(0,l.register)(m);const u=m;var d=n(4697),E=n(7723),h=n(1455),p=n.n(h);async function g(e,t,n){n=n||{},t=t||{};const c=[["X-WP-Nonce",content_restriction_admin.rest_args.nonce]];return await p()({path:e,method:"POST",data:t,headers:c,...n}).then((e=>e)).catch((e=>{throw e}))}const{confirm:M}=d.A;var N=n(2359);function b(e,t){N.Ay[e]({message:t,placement:"bottomLeft"})}function w({}){const[e,t]=(0,o.useState)({}),[n,_]=(0,o.useState)(""),[m,d]=(0,o.useState)("Untitled Rule"),[h,p]=(0,o.useState)(!1),[M,N]=(0,o.useState)(!1),[w,y]=(0,o.useState)(!1),v=(0,a.Zp)(),S=(0,l.select)("content-restriction-stores"),I=(0,o.useRef)(null),C=e=>{I.current&&!I.current.contains(e.target)&&y(!1)};(0,o.useEffect)((()=>(document.addEventListener("mousedown",C),()=>{document.removeEventListener("mousedown",C)})),[]),(0,o.useEffect)((()=>{const e=(0,l.subscribe)((()=>{const e=S.getId(),n=S.getRuleData(),c=S.getRuleTitle(),r=S.getRuleStatus();_(e),d(c||m),t(n),N(r)}));return()=>e()}));const T=(0,o.useRef)(null);(0,o.useEffect)((()=>{const e=e=>{if(h){const t=T.current?.contains(e.target),n=e.target.classList.contains("anticon-edit");t||n||p(!1)}};return document.addEventListener("click",e),()=>{document.removeEventListener("click",e)}}),[h]);const j=n?()=>function(e,t,n,c){t&&t.hasOwnProperty("who-can-see")&&t.hasOwnProperty("what-content")&&t.hasOwnProperty("restrict-view")?g("content-restriction/rules/update",{id:e,data:{status:c,title:n,rule:t}}).then((e=>{b("success",(0,E.__)("Successfully Updated!","content-restriction"))})).catch((e=>{b("error",(0,E.__)("Rules update error","content-restriction"))})):b("warning",(0,E.__)("Please complete the setup","content-restriction"))}(n,e,m,M):()=>function(e,t,n,c){e&&e.hasOwnProperty("who-can-see")&&e.hasOwnProperty("what-content")&&e.hasOwnProperty("restrict-view")?g("content-restriction/rules/create",{data:{status:n,title:t,rule:e}}).then((e=>{b("success",(0,E.__)("Successfully Created!","content-restriction")),c(`/rule/${e}`)})).catch((e=>{b("error",(0,E.__)("Rules create error","content-restriction"))})):b("warning",(0,E.__)("Please complete the setup","content-restriction"))}(e,m,M,v);return(0,c.createElement)(c.Fragment,null,(0,c.createElement)("div",{className:"content-restriction__header"},(0,c.createElement)("div",{className:"content-restriction__header__action content-restriction__header__action--left"},(0,c.createElement)(r.N_,{to:"/",class:"content-restriction__btn content-restriction__btn--sm content-restriction__btn--back"},(0,c.createElement)(i.A,null),(0,E.__)("Back","content-restriction")),(0,c.createElement)("div",{className:"content-restriction__header__action__input"},h?(0,c.createElement)("input",{type:"text",ref:T,value:m,onChange:e=>(0,l.dispatch)(u).setRuleTitle(e.target.value)}):(0,c.createElement)("h2",{className:"content-restriction__header__title"},m),(0,c.createElement)("p",{className:"content-restriction__header__action__edit"},h?(0,c.createElement)(i.A,{onClick:e=>{e.stopPropagation(),p(!1)}}):(0,c.createElement)(s.A,{onClick:e=>{e.stopPropagation(),p(!0)}})))),(0,c.createElement)("div",{className:"content-restriction__header__action content-restriction__header__action--right"},(0,c.createElement)("button",{className:"content-restriction__btn content-restriction__btn--create",onClick:j},n?(0,E.__)("Update","content-restriction"):(0,E.__)("Publish","content-restriction")))))}var y=n(2318),v=n(1005),S=n(441);function I(e){const{id:t,type:n,openKey:r,setOpenKey:a,changeAction:i,resetType:s}=e,l=(0,o.useRef)(null);(0,o.useEffect)((()=>{const e=e=>{!l.current||l.current.contains(e.target)||e.target.closest(".ant-dropdown-trigger")||setTimeout((()=>{a(null)}),100)};return document.addEventListener("mousedown",e),()=>{document.removeEventListener("mousedown",e)}}),[a]);const _=[{key:"remove",label:(0,c.createElement)("a",{onClick:e=>{e.stopPropagation(),s(e,n)}},(0,E.__)("Remove","content-restriction"))},{key:"change",label:(0,c.createElement)("a",{onClick:e=>{e.stopPropagation(),i(e,n)}},(0,E.__)("Change","content-restriction"))}],m=r===n;return(0,c.createElement)("div",{ref:l},(0,c.createElement)(S.A,{menu:{items:_},trigger:["click"],placement:"bottomRight",open:!t&&m,onOpenChange:()=>{a(n)}},(0,c.createElement)("button",{className:"content-restriction__single__btn__action",onClick:e=>{e.stopPropagation(),t?i(e,n):a(n)}},t?(0,c.createElement)(v.A,null):(0,c.createElement)(y.A,null))))}function C(e){return"string"!=typeof e?"":e.replace(/[^a-zA-Z0-9]/g," ").split(/[\s_]+/).map((e=>e.charAt(0).toUpperCase()+e.slice(1))).join(" ")}const T="data:image/svg+xml;base64,PHN2ZyBmaWxsPSJub25lIiBoZWlnaHQ9IjQ4IiB2aWV3Qm94PSIwIDAgNDAgNDgiIHdpZHRoPSI0MCIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48cGF0aCBjbGlwLXJ1bGU9ImV2ZW5vZGQiIGQ9Im0yMCA0NGMxMS4wNDU3IDAgMjAtOC45NTQzIDIwLTIwcy04Ljk1NDMtMjAtMjAtMjBjLTExLjA0NTcyIDAtMjAgOC45NTQzLTIwIDIwczguOTU0MjggMjAgMjAgMjB6bTYuMjM5My0zMC42ODMyYy4zMDM3LTEuMDc4Ny0uNzQzMi0xLjcxNjctMS42OTkzLTEuMDM1NWwtMTMuMzQ2OSA5LjUwODNjLTEuMDM2OS43Mzg3LS44NzM4IDIuMjEwNC4yNDUgMi4yMTA0aDMuNTE0NnYtLjAyNzJoNi44NDk4bC01LjU4MTMgMS45NjkzLTIuNDYwNSA4Ljc0MTFjLS4zMDM3IDEuMDc4OC43NDMxIDEuNzE2NyAxLjY5OTMgMS4wMzU1bDEzLjM0NjktOS41MDgyYzEuMDM2OS0uNzM4Ny44NzM3LTIuMjEwNS0uMjQ1LTIuMjEwNWgtNS4zMjk4eiIgZmlsbD0iIzE1NWVlZiIgZmlsbC1ydWxlPSJldmVub2RkIi8+PC9zdmc+";var j=n(7072);const f=()=>(0,c.createElement)(c.Fragment,null,(0,c.createElement)("li",{className:"content-restriction__type__item"},(0,c.createElement)("button",{className:"content-restriction__type__btn"},(0,c.createElement)(j.A,{active:!0,paragraph:{rows:4}}))),(0,c.createElement)("li",{className:"content-restriction__type__item"},(0,c.createElement)("button",{className:"content-restriction__type__btn"},(0,c.createElement)(j.A,{active:!0,paragraph:{rows:4}}))),(0,c.createElement)("li",{className:"content-restriction__type__item"},(0,c.createElement)("button",{className:"content-restriction__type__btn"},(0,c.createElement)(j.A,{active:!0,paragraph:{rows:4}}))),(0,c.createElement)("li",{className:"content-restriction__type__item"},(0,c.createElement)("button",{className:"content-restriction__type__btn"},(0,c.createElement)(j.A,{active:!0,paragraph:{rows:4}}))),(0,c.createElement)("li",{className:"content-restriction__type__item"},(0,c.createElement)("button",{className:"content-restriction__type__btn"},(0,c.createElement)(j.A,{active:!0,paragraph:{rows:4}}))),(0,c.createElement)("li",{className:"content-restriction__type__item"},(0,c.createElement)("button",{className:"content-restriction__type__btn"},(0,c.createElement)(j.A,{active:!0,paragraph:{rows:4}})))),D=()=>{const e=(0,l.select)("content-restriction-stores"),[t,n]=(0,o.useState)(e.getRuleType()||"who-can-see"),[r,a]=(0,o.useState)([]),[i,s]=(0,o.useState)([]),[_,m]=(0,o.useState)(""),[d,h]=(0,o.useState)(!1),[p,M]=(0,o.useState)(e.getModal()||!1),[N,b]=(0,o.useState)("-"),[w,y]=(0,o.useState)("-"),v=(0,l.subscribe)((()=>{const t=e.getModal(),c=e.getRuleType();M(t),n(c),"restrict-view"===c&&(b((0,E.__)("How should the content be protected?","content-restriction")),y((0,E.__)("When user does not have access permission, the following options help control their experience.","content-restriction"))),"what-content"===c&&(b((0,E.__)("What content will be unlocked?","content-restriction")),y((0,E.__)("When user have access permission, the following content will be available.","content-restriction"))),"who-can-see"===c&&(b((0,E.__)("Who can see the content?","content-restriction")),y((0,E.__)("Which user type should be allowed to see the content.","content-restriction")))}));(0,o.useEffect)((()=>(M(e.getModal()),()=>v())));const S=()=>{M(e.getModal());const n=e.getWhatContent(),c=e.getWhoCanSee(),r=e.getRestrictView();t&&g(`content-restriction/modules/${t}`,{what_content:n?.key,who_can_see:c?.key,restrict_view:r?.key}).then((e=>{a(e),h(!0);let i=null;"who-can-see"===t?i=c?.key:"what-content"===t?i=n?.key:"restrict-view"===t&&(i=r?.key);const s=e.find((e=>e.key===i));s&&("who-can-see"===t?(0,l.dispatch)(u).setWhoCanSee(s):"what-content"===t?(0,l.dispatch)(u).setWhatContent(s):"restrict-view"===t&&(0,l.dispatch)(u).setRestrictView(s))}))};(0,o.useEffect)((()=>{S(),h(!1)}),[t]),(0,o.useEffect)((()=>{const e=r.reduce(((e,t)=>{const n=t.group||"others";return e[n]||(e[n]=[]),e[n].push(t),e}),{}),t=Object.keys(e);s(t)}),[r]),(0,o.useEffect)((()=>{S()}),[]);const I=()=>{(0,l.dispatch)(u).setModalVisible(!1)};return(0,c.createElement)("div",{className:"content-restriction__modal "+(p?"content-restriction__modal--visible":"")},(0,c.createElement)("div",{className:"content-restriction__modal__overlay",onClick:I}),(0,c.createElement)("div",{className:"content-restriction__modal__content"},(0,c.createElement)("div",{className:"content-restriction__modal__content__header"},(0,c.createElement)("div",{className:"content-restriction__modal__content__header__info"},(0,c.createElement)("div",{class:"info-text"},(0,c.createElement)("h2",{class:"content-restriction__modal__content__title"},N),(0,c.createElement)("p",{class:"content-restriction__modal__content__desc"},w))),(0,c.createElement)("div",{className:"content-restriction__modal__content__header__action"},(0,c.createElement)("button",{className:"content-restriction__modal__content__close-btn",onClick:I},"x"))),(0,c.createElement)("div",{className:"content-restriction__modal__content__body"},(0,c.createElement)("div",{className:"content-restriction__modal__content__wrapper"},(0,c.createElement)("div",{className:"content-restriction__module"},r.length>0?(0,c.createElement)(c.Fragment,null,i.length>0&&"what-content"===t&&(0,c.createElement)("ul",{className:"content-restriction__group"},(0,c.createElement)("li",{key:"all",className:"content-restriction__group__item"},(0,c.createElement)("button",{className:"content-restriction__group__btn "+(_?"":"active"),onClick:()=>m("")},"All")),i.map((e=>(0,c.createElement)("li",{key:e,className:"content-restriction__group__item"},(0,c.createElement)("button",{className:"content-restriction__group__btn "+(_===e?"active":""),onClick:()=>m(e)},e.split(" ").map((e=>e.charAt(0).toUpperCase()+e.slice(1).toLowerCase())).join(" ")))))),(0,c.createElement)("ul",{className:"content-restriction__type"},d?r.filter((e=>!_||("others"===_?!e.group:e.group===_))).map(((n,r)=>(0,c.createElement)("li",{className:"content-restriction__type__item "+(n.upcoming||n.is_pro&&!content_restriction_admin.pro_available?"pro-item":""),key:r},(0,c.createElement)("button",{className:"content-restriction__type__btn",onClick:n.upcoming||n.is_pro&&!content_restriction_admin.pro_available?void 0:()=>((t,n)=>{(0,l.dispatch)(u).setModalVisible(!1),(0,l.dispatch)(u).setSidebarVisible(!0),(0,l.dispatch)(u).setRuleType(t);const c={...e.getRuleData(),[t]:n.key};(0,l.dispatch)(u).setRule(c),"who-can-see"===t?(0,l.dispatch)(u).setWhoCanSee(n):"what-content"===t?(0,l.dispatch)(u).setWhatContent(n):"restrict-view"===t&&(0,l.dispatch)(u).setRestrictView(n)})(t,n),title:n.is_pro?(0,E.__)("Upgrade Now","content-restriction"):n.upcoming?(0,E.__)("Upcoming","content-restriction"):""},n.upcoming&&(0,c.createElement)("span",{className:"upcoming-badge"},(0,E.__)("Upcoming","content-restriction")),n.is_pro&&content_restriction_admin.pro_available&&(0,c.createElement)("span",{className:"pro-badge"},(0,c.createElement)("svg",{width:"20",height:"20",viewBox:"0 0 12 12",fill:"none",xmlns:"http://www.w3.org/2000/svg"},(0,c.createElement)("g",{clipPath:"url(#clip0_457_540)"},(0,c.createElement)("path",{d:"M12 3.06766C12 2.40317 11.4594 1.86264 10.795 1.86264C10.1305 1.86264 9.58997 2.40317 9.58997 3.06766C9.58997 3.61594 9.61278 4.33792 9.16941 4.66046L8.70365 4.9993C8.219 5.35188 7.53519 5.20188 7.24262 4.67881L7.01772 4.27675C6.7391 3.77861 7.00523 3.12326 7.14059 2.56878C7.16295 2.47719 7.1748 2.38153 7.1748 2.28314C7.1748 1.61865 6.63428 1.07812 5.96979 1.07812C5.3053 1.07812 4.76477 1.61865 4.76477 2.28314C4.76477 2.39417 4.77986 2.50174 4.80809 2.6039C4.95811 3.1467 5.23419 3.78222 4.97543 4.2824L4.80172 4.61819C4.51816 5.16632 3.81066 5.32929 3.31588 4.96046L2.82316 4.59317C2.37951 4.26245 2.41013 3.53404 2.41013 2.98068C2.41013 2.31619 1.8696 1.77567 1.20511 1.77567C0.540527 1.77567 0 2.31619 0 2.98068C0 3.33173 0.150933 3.64809 0.391293 3.86846C0.666239 4.12054 0.977007 4.37886 1.06625 4.74104L2.29778 9.73924C2.40786 10.186 2.80861 10.5 3.26874 10.5H8.80645C9.26982 10.5 9.6725 10.1817 9.77945 9.73081L10.9414 4.83229C11.028 4.46732 11.3394 4.20557 11.6143 3.95037C11.8514 3.73024 12 3.41603 12 3.06766Z",fill:"#F17D0E"})),(0,c.createElement)("defs",null,(0,c.createElement)("clipPath",{id:"clip0_457_540"},(0,c.createElement)("rect",{width:"12",height:"12",fill:"white"}))))),(0,c.createElement)("img",{src:n?.icon||T,alt:n.name}),(0,c.createElement)("h3",null,n.name),(0,c.createElement)("span",null,n.desc))))):(0,c.createElement)(f,null))):"")))))};var k=n(7256),A=n(2154),z=n(1575);function R(e){return Object.entries(e||{}).map((([e,t])=>({value:e,label:"string"==typeof t?t:t.title})))}const{TextArea:L}=k.A,x=()=>{const[e,t]=(0,o.useState)(!1),[n,r]=(0,o.useState)("Action"),[a,i]=(0,o.useState)(),[s,_]=(0,o.useState)(!1),[m,d]=(0,o.useState)(!1),[h,p]=(0,o.useState)(null),[g,M]=(0,o.useState)([]),[N,b]=(0,o.useState)(null),[w,y]=(0,o.useState)({}),[v,S]=(0,o.useState)("");(0,o.useEffect)((()=>{const e=(0,l.select)("content-restriction-stores");_(e.getSidebar());const n=(0,l.subscribe)((()=>{const n=e.getSidebar(),c=e.getRuleType(),a=e.getRuleData(),s=e.getWhoCanSee(),l=e.getWhatContent(),o=e.getRestrictView();_(n),t(c),y(a),"who-can-see"===c?(i(s),r(s.name)):"what-content"===c?(i(l),r(l.name)):"restrict-view"===c&&(i(o),r(o.name))}));return()=>n()}));const I=(t,n)=>{y((c=>({...c,[e]:{[a.key]:{...c[e]?.[a.key],[t]:n}}})))};return(0,o.useEffect)((()=>{const e=w&&w["what-content"];if(e&&"object"==typeof e)for(const[t,n]of Object.entries(e))S(t);else S(e);(0,l.dispatch)(u).setRule(w)}),[w]),(0,o.useEffect)((()=>{if(p(null),M(null),b(null),a&&!a?.options)y((t=>({...t,[e]:a?.key})));else if(a&&e&&w&&w[e]?.[a.key]){const t=w[e][a.key];if("string"==typeof t||"number"==typeof t)p(t),M([]),b([]);else if("object"==typeof t){const e=Object.keys(t)[0];if(p(e),Array.isArray(t[e])){b(t[e]);const n=a.options[e];if(n&&"multi-select"===n.type){const e=Object.entries(n.options||{}).map((([e,t])=>({value:e,label:t})));M(e)}}else M([]),b([])}}else y((t=>({...t,[e]:a?.key})))}),[a]),(0,c.createElement)("div",{className:"content-restriction__sidebar "+(s?"content-restriction__sidebar--visible":"")},a?(0,c.createElement)("div",{className:"content-restriction__sidebar__content"},(0,c.createElement)("div",{className:"content-restriction__sidebar__content__header"},(0,c.createElement)("h2",{className:"content-restriction__sidebar__content__title"},n),(0,c.createElement)("button",{className:"content-restriction__sidebar__content__btn",onClick:e=>(e=>{e.stopPropagation(),(0,l.dispatch)(u).setSidebarVisible(!1),(0,l.dispatch)(u).setModalVisible(!0)})(e)},(0,E.__)("Change","content-restriction")),(0,c.createElement)("button",{className:"content-restriction__sidebar__content__close-btn",onClick:()=>{(0,l.dispatch)(u).setSidebarVisible(!1)}},"x")),(0,c.createElement)("div",{className:"content-restriction__sidebar__content__body"},(0,c.createElement)("div",{className:"content-restriction__sidebar__tab"},(0,c.createElement)("div",{className:"tab-content content-restriction__sidebar__tab__content",id:"nav-tabContent"},(0,c.createElement)("div",{className:"content-restriction__sidebar__tab__content__event"},(0,c.createElement)("div",{className:"content-restriction__sidebar__tab__content__event__wrapper"},"select"===a?.type?(0,c.createElement)(c.Fragment,null,(0,c.createElement)("h3",{className:"content-restriction__sidebar__tab__content__event__title"},(0,E.__)("Select ","content-restriction")," ",a?.name,"   ",(0,E.__)("(required) ","content-restriction")),(0,c.createElement)(A.A,{allowClear:!0,style:{width:"100%",marginBottom:"10px"},placeholder:(0,E.__)("Please select an option","content-restriction"),onChange:t=>{const n=a.options[t];if(p(t),b([]),n&&"object"==typeof n&&"multi-select"===n.type){const c=Object.entries(n.options||{}).map((([e,t])=>({value:e,label:t})));M(c),y((n=>({...n,[e]:{[a.key]:{[t]:[]}}})))}else n?(M([]),y((n=>({...n,[e]:{[a.key]:t}})))):M([])},options:R(a?.options),value:h}),h&&g.length>0&&(0,c.createElement)(c.Fragment,null,(0,c.createElement)("h3",{className:"content-restriction__sidebar__tab__content__event__title"}," ",(0,E.__)("Choose","content-restriction")," ",C(h)),(0,c.createElement)(A.A,{mode:"multiple",allowClear:!0,style:{width:"100%"},placeholder:`Select ${h} option`,onChange:t=>{b(t),y((n=>({...n,[e]:{[a.key]:{[h]:t}}})))},options:g,value:N}))):"section"===a?.type?(0,c.createElement)(c.Fragment,null,a.options&&Object.entries(a.options).length>0?Object.entries(a.options).map((([t,n])=>"text"===n.type||"url"===n.type?(0,c.createElement)("div",{className:"content-restriction__sidebar__tab__content__event__section-wrapper",key:t},(0,c.createElement)("h3",{className:"content-restriction__sidebar__tab__content__event__title"},n.title),(0,c.createElement)(k.A,{id:`content-restriction__${t}`,placeholder:`Type ${n.title}`,value:w&&w[e]?.[a.key]?.[t]||"",onChange:e=>I(t,e.target.value)})):"textarea"===n.type?(0,c.createElement)("div",{className:"content-restriction__sidebar__tab__content__event__section-wrapper",key:t},(0,c.createElement)("h3",{className:"content-restriction__sidebar__tab__content__event__title"},n.title),(0,c.createElement)(L,{id:`content-restriction__${t}`,rows:4,placeholder:`Type ${n.title}`,value:w&&w[e]?.[a.key]?.[t]||"",onChange:e=>I(t,e.target.value)})):"range"===n.type?(0,c.createElement)("div",{className:"content-restriction__sidebar__tab__content__event__section-wrapper",key:t},(0,c.createElement)("h3",{className:"content-restriction__sidebar__tab__content__event__title"},n.title),(0,c.createElement)(z.A,{defaultValue:n.default,value:w&&w[e]?.[a.key]?.[t]||n.default,onChange:e=>I(t,e)})):"multi-select"===n.type?(0,c.createElement)("div",{className:"content-restriction__sidebar__tab__content__event__section-wrapper",key:t},(0,c.createElement)("h3",{className:"content-restriction__sidebar__tab__content__event__title"},n.title),(0,c.createElement)(A.A,{mode:"multiple",allowClear:!0,style:{width:"100%"},placeholder:(0,E.__)("Please select","content-restriction"),onChange:e=>I(t,e),options:R(n.options),value:w&&w[e]?.[a.key]?.[t]||[]})):null)):(0,c.createElement)("div",null,(0,E.__)("No options available","content-restriction"))):(0,c.createElement)(c.Fragment,null,(0,c.createElement)("p",{className:"content-restriction__sidebar__tab__content__event__desc"},a?.desc)))))))):null)},O=()=>(0,c.createElement)(c.Fragment,null,(0,c.createElement)("div",{className:"content-restriction__single__btn"},(0,c.createElement)(j.A,{active:!0,title:!1,paragraph:{rows:1,width:"100%"}})));function V(){const[e,t]=(0,o.useState)(null),[n,r]=(0,o.useState)([]),[a,i]=(0,o.useState)(""),[s,_]=(0,o.useState)(""),[m,d]=(0,o.useState)(""),[h,p]=(0,o.useState)(null),[M,N]=(0,o.useState)(!1),[b,w]=(0,o.useState)(T),[y,v]=(0,o.useState)(T),[S,j]=(0,o.useState)(T),f={name:"",key:"",type:"",options:""};(0,o.useEffect)((()=>{const e=window.location.href.split("/"),n=e[e.length-1];if("rule"===n)return N(!0),(0,l.dispatch)(u).setWhoCanSee(f),(0,l.dispatch)(u).setWhatContent(f),(0,l.dispatch)(u).setRestrictView(f),(0,l.dispatch)(u).setRuleTitle(""),(0,l.dispatch)(u).setRulePublished(""),(0,l.dispatch)(u).setId(""),void(0,l.dispatch)(u).setRule("");t(e[6]),g("content-restriction/rules/list").then((e=>{r(e);const t=e.length>0&&e.find((e=>e.id===n));(0,l.dispatch)(u).setId(t?.id),(0,l.dispatch)(u).setRule(t?.rule),(0,l.dispatch)(u).setRulePublished(t?.status),(0,l.dispatch)(u).setRuleTitle(t?.title);const c=t&&t?.rule["who-can-see"]?"object"==typeof t?.rule["who-can-see"]?Object.keys(t?.rule["who-can-see"])[0]:"string"==typeof t?.rule["who-can-see"]?t?.rule["who-can-see"]:"":"",a=t&&t?.rule["what-content"]?"object"==typeof t?.rule["what-content"]?Object.keys(t?.rule["what-content"])[0]:"string"==typeof t?.rule["what-content"]?t?.rule["what-content"]:"":"",s=t&&t?.rule["restrict-view"]?"object"==typeof t?.rule["restrict-view"]?Object.keys(t?.rule["restrict-view"])[0]:"string"==typeof t?.rule["restrict-view"]?t?.rule["restrict-view"]:"":"";i(C(c)),_(C(a)),d(C(s));const o=async(e,t)=>{try{const n=(e&&await g(`content-restriction/modules/${e}`,{what_content:a,who_can_see:c,restrict_view:s})).find((e=>e.key===t));n&&("who-can-see"===e?(0,l.dispatch)(u).setWhoCanSee(n):"what-content"===e?(0,l.dispatch)(u).setWhatContent(n):"restrict-view"===e&&(0,l.dispatch)(u).setRestrictView(n))}catch(e){}};o("who-can-see",c),o("what-content",a),o("restrict-view",s),N(!0)})).catch((e=>{}))}),[]),(0,o.useEffect)((()=>{const e=(0,l.select)("content-restriction-stores"),t=(0,l.subscribe)((()=>{var t,n,c;const r=e.getWhoCanSee(),a=e.getWhatContent(),s=e.getRestrictView();i(r.name),_(a.name),d(s.name),w(null!==(t=r.icon)&&void 0!==t?t:b),v(null!==(n=a.icon)&&void 0!==n?n:y),j(null!==(c=s.icon)&&void 0!==c?c:S)}));return()=>t()}),[n]);const k=(e,t)=>{e.stopPropagation(),(0,l.dispatch)(u).setRuleType(t),"who-can-see"===t?a?z():A():"what-content"===t?s?z():A():"restrict-view"===t&&(m?z():A())},A=()=>{p(null),(0,l.dispatch)(u).setModalVisible(!0)},z=()=>{p(null),(0,l.dispatch)(u).setSidebarVisible(!0)},R=(e,t)=>{e.stopPropagation(),(0,l.dispatch)(u).setModalVisible(!1),(0,l.dispatch)(u).setSidebarVisible(!1),"who-can-see"===t?(i(""),(0,l.dispatch)(u).setWhoCanSee(f)):"what-content"===t?(_(""),(0,l.dispatch)(u).setWhatContent(f)):"restrict-view"===t&&(d(""),(0,l.dispatch)(u).setRestrictView(f))},L=(e,t)=>{e.stopPropagation(),p(null),(0,l.dispatch)(u).setRuleType(t),(0,l.dispatch)(u).setModalVisible(!0)};return(0,c.createElement)(c.Fragment,null,(0,c.createElement)("section",{className:"content-restriction__create-rules"},M?(0,c.createElement)(c.Fragment,null,(0,c.createElement)("div",{className:"content-restriction__single"},(0,c.createElement)("div",{className:"content-restriction__single__btn",onClick:e=>k(e,"who-can-see")},(0,c.createElement)("img",{src:b}),a?(0,c.createElement)(c.Fragment,null,(0,c.createElement)("h3",{className:"content-restriction__single__btn__title"},a),(0,c.createElement)(I,{id:e,type:"who-can-see",openKey:h,setOpenKey:p,changeAction:L,resetType:R})):(0,c.createElement)("h3",{className:"content-restriction__single__btn__title"},(0,E.__)("Who can see the content?","content-restriction")))),(0,c.createElement)("div",{className:"content-restriction__single"},(0,c.createElement)("div",{className:"content-restriction__single__btn "+(a?"":"disabled"),onClick:e=>k(e,"what-content")},(0,c.createElement)("img",{src:y}),s?(0,c.createElement)(c.Fragment,null,(0,c.createElement)("h3",{className:"content-restriction__single__btn__title"},s),(0,c.createElement)(I,{id:e,type:"what-content",openKey:h,setOpenKey:p,changeAction:L,resetType:R})):(0,c.createElement)("h3",{className:"content-restriction__single__btn__title"},(0,E.__)("What content will be unlocked?","content-restriction")))),(0,c.createElement)("div",{className:"content-restriction__single"},(0,c.createElement)("div",{className:"content-restriction__single__btn "+(a&&s?"":"disabled"),onClick:e=>k(e,"restrict-view")},(0,c.createElement)("img",{src:S}),m?(0,c.createElement)(c.Fragment,null,(0,c.createElement)("h3",{className:"content-restriction__single__btn__title"},m),(0,c.createElement)(I,{id:e,type:"restrict-view",openKey:h,setOpenKey:p,changeAction:L,resetType:R})):(0,c.createElement)("h3",{className:"content-restriction__single__btn__title"},(0,E.__)("How should the content be protected?","content-restriction"))))):(0,c.createElement)(c.Fragment,null,(0,c.createElement)(O,null),(0,c.createElement)(O,null),(0,c.createElement)(O,null))),(0,c.createElement)(D,null),(0,c.createElement)(x,null))}function W(){return(0,c.createElement)(c.Fragment,null,(0,c.createElement)(w,null),(0,c.createElement)(V,null))}var U=n(9266);const P=[{key:"rules",label:(0,c.createElement)(r.N_,{to:"/rules",className:"content-restriction__menu__single"},(0,E.__)("Rules","content-restriction"))},{key:"integrations",label:(0,c.createElement)(r.N_,{to:"/integrations",className:"content-restriction__menu__single"},(0,E.__)("Integrations","content-restriction"))},{key:"license",label:content_restriction_admin.pro_available?"":(0,c.createElement)("a",{href:"https://contentrestriction.com/pricing/?utm_source=wp-plugins&utm_campaign=upgrade-to-pro&utm_medium=wp-dash",target:"_blank",className:"upgrade-to-pro"},(0,c.createElement)("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",xmlns:"http://www.w3.org/2000/svg"},(0,c.createElement)("g",{"clip-path":"url(#clip0_457_540)"},(0,c.createElement)("path",{d:"M12 3.06766C12 2.40317 11.4594 1.86264 10.795 1.86264C10.1305 1.86264 9.58997 2.40317 9.58997 3.06766C9.58997 3.61594 9.61278 4.33792 9.16941 4.66046L8.70365 4.9993C8.219 5.35188 7.53519 5.20188 7.24262 4.67881L7.01772 4.27675C6.7391 3.77861 7.00523 3.12326 7.14059 2.56878C7.16295 2.47719 7.1748 2.38153 7.1748 2.28314C7.1748 1.61865 6.63428 1.07812 5.96979 1.07812C5.3053 1.07812 4.76477 1.61865 4.76477 2.28314C4.76477 2.39417 4.77986 2.50174 4.80809 2.6039C4.95811 3.1467 5.23419 3.78222 4.97543 4.2824L4.80172 4.61819C4.51816 5.16632 3.81066 5.32929 3.31588 4.96046L2.82316 4.59317C2.37951 4.26245 2.41013 3.53404 2.41013 2.98068C2.41013 2.31619 1.8696 1.77567 1.20511 1.77567C0.540527 1.77567 0 2.31619 0 2.98068C0 3.33173 0.150933 3.64809 0.391293 3.86846C0.666239 4.12054 0.977007 4.37886 1.06625 4.74104L2.29778 9.73924C2.40786 10.186 2.80861 10.5 3.26874 10.5H8.80645C9.26982 10.5 9.6725 10.1817 9.77945 9.73081L10.9414 4.83229C11.028 4.46732 11.3394 4.20557 11.6143 3.95037C11.8514 3.73024 12 3.41603 12 3.06766Z",fill:"#F17D0E"})),(0,c.createElement)("defs",null,(0,c.createElement)("clipPath",{id:"clip0_457_540"},(0,c.createElement)("rect",{width:"12",height:"12",fill:"white"})))),(0,E.__)("Upgrade Now","content-restriction"))}];function H({menuKey:e}){return(0,c.createElement)(U.A,{selectedKeys:[e],mode:"horizontal",items:P,lineWidth:"0",style:{width:"100%",lineHeight:"70px"}})}function Q({menuKey:e}){return(0,c.createElement)(c.Fragment,null,(0,c.createElement)("div",{className:"content-restriction__header"},(0,c.createElement)("div",{className:"content-restriction__header__action content-restriction__header__action--left"},(0,c.createElement)(r.N_,{to:"/",className:"content-restriction__menu__single"},(0,c.createElement)("img",{src:"data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSI0MyIgaGVpZ2h0PSI0MyIgdmlld0JveD0iMCAwIDQzIDQzIiBmaWxsPSJub25lIj4KPHBhdGggZD0iTTAgM0MwIDEuMzQzMTQgMS4zNDMxNSAwIDMgMEg0MEM0MS42NTY5IDAgNDMgMS4zNDMxNSA0MyAzVjQwQzQzIDQxLjY1NjkgNDEuNjU2OSA0MyA0MCA0M0gzQzEuMzQzMTQgNDMgMCA0MS42NTY5IDAgNDBWM1oiIGZpbGw9IiMzNzQ3RDYiLz4KPHBhdGggZD0iTTEyLjM5MDkgMTMuNjYzSDEzLjU0MTkiIHN0cm9rZT0id2hpdGUiIHN0cm9rZS13aWR0aD0iMS41IiBzdHJva2UtbGluZWNhcD0icm91bmQiIHN0cm9rZS1saW5lam9pbj0icm91bmQiLz4KPHBhdGggZD0iTTE2LjY1NDggMTMuNjYzSDI3LjE5NTMiIHN0cm9rZT0id2hpdGUiIHN0cm9rZS13aWR0aD0iMS41IiBzdHJva2UtbGluZWNhcD0icm91bmQiIHN0cm9rZS1saW5lam9pbj0icm91bmQiLz4KPHBhdGggZD0iTTE2LjM2NjkgMjkuNDI5NUMxNi4zNjY5IDI4LjM5OTUgMTYuMzY2OSAyNy45MTE2IDE2LjcxMjMgMjcuNTg2NEMxNy4wNTc2IDI3LjI2MTEgMTcuNTc1NiAyNy4yNjExIDE4LjY2OTEgMjcuMjYxMUgyMy4yNzM0QzI0LjM2NjkgMjcuMjYxMSAyNC44ODQ5IDI3LjI2MTEgMjUuMjMwMyAyNy41ODY0QzI1LjU3NTYgMjcuOTExNiAyNS41NzU2IDI4LjM5OTUgMjUuNTc1NiAyOS40Mjk1VjMwLjUxMzdDMjUuNTc1NiAzMi4wMzE1IDI1LjU3NTYgMzIuNzkwNSAyNS4wNTc2IDMzLjI3ODNDMjQuNTM5NiAzMy43NjYyIDIzLjczMzggMzMuNzY2MiAyMi4xMjIzIDMzLjc2NjJIMTkuODIwMkMxOC4yMDg3IDMzLjc2NjIgMTcuNDAyOSAzMy43NjYyIDE2Ljg4NDkgMzMuMjc4M0MxNi4zNjY5IDMyLjc5MDUgMTYuMzY2OSAzMi4wMzE1IDE2LjM2NjkgMzAuNTEzN1YyOS40Mjk1WiIgc3Ryb2tlPSIjRkZFNUQ2IiBzdHJva2Utd2lkdGg9IjEuNSIgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIi8+CjxwYXRoIGQ9Ik0yMy4yNzMzIDI2LjcxOTFWMjYuMTc3QzIzLjI3MzMgMjQuOTg0NCAyMi4yMzczIDI0LjAwODcgMjAuOTcxMSAyNC4wMDg3QzE5LjcwNDkgMjQuMDA4NyAxOC42Njg5IDI0Ljk4NDQgMTguNjY4OSAyNi4xNzdWMjYuNzE5MSIgc3Ryb2tlPSIjRkZFNUQ2IiBzdHJva2Utd2lkdGg9IjEuNSIgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIi8+CjxwYXRoIGQ9Ik0xMi42ODM1IDMyLjU1MTFDMTAuNjExNSAzMi4zMzQzIDkgMzAuNzA4IDkgMjguNzAyMlYxMy45MDMxQzkgMTEuNzM0NyAxMC44NDE3IDEwIDEzLjE0MzkgMTBIMjguODU2MUMzMS4xNTgzIDEwIDMzIDExLjczNDcgMzMgMTMuOTAzMVYyOC43MDIyQzMzIDMwLjcwOCAzMS4zODg1IDMyLjMzNDMgMjkuMzE2NSAzMi41NTExIiBzdHJva2U9IndoaXRlIiBzdHJva2Utd2lkdGg9IjIiIHN0cm9rZS1taXRlcmxpbWl0PSIxMCIgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIi8+CjxwYXRoIGQ9Ik05LjIzNDEzIDE2Ljc3NTZIMzIuNzA5MSIgc3Ryb2tlPSJ3aGl0ZSIgc3Ryb2tlLXdpZHRoPSIxLjUiIHN0cm9rZS1taXRlcmxpbWl0PSIxMCIgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIi8+Cjwvc3ZnPg==",alt:"{__( 'Content Restriction', 'content-restriction' )}"})),(0,c.createElement)("div",{className:"content-restriction__menu__single__name"},(0,c.createElement)("span",null,"All-in-One"),(0,c.createElement)("span",{className:"content-restriction__menu__single__name__highlight"},(0,E.__)("Content Restriction","content-restriction")))),(0,c.createElement)("div",{className:"content-restriction__header__action content-restriction__header__action--right"},(0,c.createElement)(H,{menuKey:e}))))}function Y({timestamp:e}){return Z(1e3*e)}const Z=e=>{const t=new Date,n=new Date(e),c=Math.floor((t-n)/1e3);let r=Math.floor(c/31536e3);return r>=1?1===r?(0,E.__)(" 1 year ago","content-restriction"):r+(0,E.__)(" years ago","content-restriction"):(r=Math.floor(c/2592e3),r>=1?1===r?(0,E.__)(" 1 month ago","content-restriction"):r+(0,E.__)(" months ago","content-restriction"):(r=Math.floor(c/86400),r>=1?1===r?(0,E.__)(" 1 day ago","content-restriction"):r+(0,E.__)(" days ago","content-restriction"):(r=Math.floor(c/3600),r>=1?1===r?(0,E.__)(" 1 hour ago","content-restriction"):r+(0,E.__)(" hours ago","content-restriction"):(r=Math.floor(c/60),r>=1?1===r?(0,E.__)(" 1 minute ago","content-restriction"):r+(0,E.__)(" minutes ago","content-restriction"):1===Math.floor(c)?(0,E.__)(" 1 second ago","content-restriction"):Math.floor(c)+(0,E.__)(" seconds ago","content-restriction")))))};var B=n(2609),F=n(955);const G=()=>(0,c.createElement)(c.Fragment,null,(0,c.createElement)("tr",null,(0,c.createElement)("td",null,(0,c.createElement)(j.A,{active:!0,title:!1,paragraph:{rows:1,width:"100%"}})),(0,c.createElement)("td",null,(0,c.createElement)(j.A,{active:!0,title:!1,paragraph:{rows:1,width:"100%"}})),(0,c.createElement)("td",null,(0,c.createElement)(j.A,{active:!0,title:!1,paragraph:{rows:1,width:"100%"}})),(0,c.createElement)("td",null,(0,c.createElement)(j.A,{active:!0,title:!1,paragraph:{rows:1,width:"100%"}}))));function J(){const e=(0,a.Zp)(),[t,n]=(0,o.useState)([]),[i,s]=(0,o.useState)({}),[_,m]=(0,o.useState)(!1);return(0,o.useEffect)((()=>{const e=t.reduce(((e,t)=>(e[t.id]=t.status,e)),{});s(e)}),[t]),(0,o.useEffect)((()=>{g("content-restriction/rules/list").then((e=>{n(e),m(!0)})).catch((e=>{b("error",(0,E.__)("Something wen't wrong!","content-restriction"))})),(0,l.dispatch)(u).setSidebarVisible(!1)}),[]),(0,c.createElement)("div",{class:"content-restriction__rules relative"},(0,c.createElement)("table",{class:"content-restriction__rules__list"},(0,c.createElement)("thead",{class:"content-restriction__rules__list__header"},(0,c.createElement)("tr",null,(0,c.createElement)("th",{scope:"col",width:"5%"},(0,E.__)("Status","content-restriction")),(0,c.createElement)("th",{scope:"col"},(0,E.__)("Name","content-restriction")),(0,c.createElement)("th",{scope:"col"},(0,E.__)("Last edit","content-restriction")),(0,c.createElement)("th",{scope:"col",width:"5%",className:"text-center"},(0,E.__)("Actions","content-restriction")))),(0,c.createElement)("tbody",{class:"content-restriction__rules__body"},t.length>0?t.map(((t,n)=>(0,c.createElement)("tr",{key:n},(0,c.createElement)("td",null,(0,c.createElement)(B.A,{checked:i[t.id],onChange:e=>((e,t,n,c)=>{s({...i,[t]:e}),g("content-restriction/rules/update",{id:t,data:{status:e,title:n,rule:c}}).then((e=>{b("success",(0,E.__)("Successfully updated!","content-restriction"))})).catch((e=>{b("error",(0,E.__)("Status update error","content-restriction"))}))})(e,t.id,t.title,t.rule),checkedChildren:"",unCheckedChildren:""})),(0,c.createElement)("td",null,(0,c.createElement)(r.N_,{to:`/rule/${t.id}`},t.title)),(0,c.createElement)("td",null,(0,c.createElement)(Y,{timestamp:t.modified})),(0,c.createElement)("td",{className:"content-restriction__rules__action"},(0,c.createElement)(F.A,{title:(0,E.__)("Delete","content-restriction")},(0,c.createElement)("a",{href:"#",className:"delete-btn"},(0,c.createElement)("svg",{onClick:()=>{return n=t.id,c=e,void M({title:(0,E.__)("Are you sure you want to delete this item?","content-restriction"),content:(0,E.__)("This action cannot be undone.","content-restriction"),okText:(0,E.__)("Confirm","content-restriction"),okType:"danger",cancelText:(0,E.__)("Cancel","content-restriction"),onOk(){((e,t)=>{g(`content-restriction/rules/delete?id=${e}`).then((e=>{t("/rules"),window.location.reload()})).catch((e=>{}))})(n,c)},onCancel(){}});var n,c},width:"13",height:"18",viewBox:"0 0 304 384",xmlns:"http://www.w3.org/2000/svg"},(0,c.createElement)("path",{fill:"#CA0B00",d:"M21 341V85h256v256q0 18-12.5 30.5T235 384H64q-18 0-30.5-12.5T21 341M299 21v43H0V21h75L96 0h107l21 21z"})))),(0,c.createElement)(F.A,{title:"Edit"},(0,c.createElement)(r.N_,{to:`/rule/${t.id}`},(0,c.createElement)("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",height:"24",width:"24",size:"24",name:"actionEdit"},(0,c.createElement)("path",{fill:"#2D2E2E",d:"m16.92 5 3.51 3.52 1.42-1.42-4.93-4.93L3 16.09V21h4.91L19.02 9.9 17.6 8.48 7.09 19H5v-2.09L16.92 5Z"})))))))):_?(0,c.createElement)("tr",null,(0,c.createElement)("td",{colSpan:"4",className:"text-center"},(0,E.__)("No rules was found! Create new rule","content-restriction"))):(0,c.createElement)(c.Fragment,null,(0,c.createElement)(G,null),(0,c.createElement)(G,null),(0,c.createElement)(G,null)))))}function K(){return(0,c.createElement)(c.Fragment,null,(0,c.createElement)(Q,{menuKey:"rules"}),(0,c.createElement)("div",{className:"content-restriction__rules container"},(0,c.createElement)("div",{className:"content-restriction__rules__header"},(0,c.createElement)("h1",{className:"content-restriction__rules__header__title"},"Rules"),(0,c.createElement)(r.N_,{to:"/rule",className:"content-restriction__btn content-restriction__btn--create"},(0,c.createElement)("svg",{width:"15",height:"15",viewBox:"0 0 29 29",fill:"none",xmlns:"http://www.w3.org/2000/svg"},(0,c.createElement)("path",{d:"M15.2031 0.4375C15.5761 0.4375 15.9338 0.585658 16.1975 0.849381C16.4612 1.1131 16.6094 1.47079 16.6094 1.84375V12.3906H27.1562C27.5292 12.3906 27.8869 12.5388 28.1506 12.8025C28.4143 13.0662 28.5625 13.4239 28.5625 13.7969V15.2031C28.5625 15.5761 28.4143 15.9338 28.1506 16.1975C27.8869 16.4612 27.5292 16.6094 27.1562 16.6094H16.6094V27.1562C16.6094 27.5292 16.4612 27.8869 16.1975 28.1506C15.9338 28.4143 15.5761 28.5625 15.2031 28.5625H13.7969C13.4239 28.5625 13.0662 28.4143 12.8025 28.1506C12.5388 27.8869 12.3906 27.5292 12.3906 27.1562V16.6094H1.84375C1.47079 16.6094 1.1131 16.4612 0.849381 16.1975C0.585658 15.9338 0.4375 15.5761 0.4375 15.2031V13.7969C0.4375 13.4239 0.585658 13.0662 0.849381 12.8025C1.1131 12.5388 1.47079 12.3906 1.84375 12.3906H12.3906V1.84375C12.3906 1.47079 12.5388 1.1131 12.8025 0.849381C13.0662 0.585658 13.4239 0.4375 13.7969 0.4375H15.2031Z",fill:"white"})),(0,c.createElement)("span",null,(0,E.__)("Create Rule","content-restriction")))),(0,c.createElement)(J,null)))}const X=()=>(0,c.createElement)("div",{class:"content-restriction__integrations__list__item"},(0,c.createElement)("div",{class:"content-restriction__integrations__list__item__header"},(0,c.createElement)(j.A,{active:!0,title:!1,paragraph:{rows:8,width:"100%"}})));function $(){const[e,t]=(0,o.useState)([]),[n,r]=(0,o.useState)(!1);return(0,o.useEffect)((()=>{g("content-restriction/settings/integrations").then((e=>{t(e),r(!0)})).catch((e=>{b("error",(0,E.__)("Something wen't wrong!","content-restriction"))}))}),[]),(0,c.createElement)("div",{class:"content-restriction__integrations__list"},n?e.map(((e,t)=>(0,c.createElement)("div",{class:"content-restriction__integrations__list__item"},(0,c.createElement)("div",{class:"content-restriction__integrations__list__item__header"},(0,c.createElement)("img",{src:e.icon,alt:e.title}),(0,c.createElement)("div",{class:"badges"},e.badges.map(((e,t)=>(0,c.createElement)("span",{class:"badge"},C(e)))))),(0,c.createElement)("h3",{class:"content-restriction__integrations__list__item__title"},e.title),(0,c.createElement)("div",{class:"content-restriction__integrations__list__item__desc"},(0,c.createElement)("p",null,e.details)),(0,c.createElement)("p",{class:"content-restriction__integrations__list__item__actions"},e.link?(0,c.createElement)("a",{target:"__blank",href:e.link+"?utm_source=plugin&utm_medium=link&utm_campaign=integrations",class:"learn-more"},(0,E.__)("Learn more","content-restriction")):(0,c.createElement)("span",null),e.action&&"upgrade"===e.action?(0,c.createElement)("a",{href:"https://contentrestriction.com/pricing/?utm_source=wp-plugins&utm_campaign=upgrade-to-pro&utm_medium=wp-dash",class:"action upgrade-to-pro",target:"__blank"},(0,E.__)("Let's go","content-restriction")):"")))):(0,c.createElement)(c.Fragment,null,(0,c.createElement)(X,null),(0,c.createElement)(X,null),(0,c.createElement)(X,null),(0,c.createElement)(X,null),(0,c.createElement)(X,null),(0,c.createElement)(X,null),(0,c.createElement)(X,null),(0,c.createElement)(X,null),(0,c.createElement)(X,null),(0,c.createElement)(X,null)))}function q(){return(0,c.createElement)(c.Fragment,null,(0,c.createElement)(Q,{menuKey:"integrations"}),(0,c.createElement)("div",{className:"content-restriction__integrations container"},(0,c.createElement)("div",{className:"content-restriction__integrations__header"},(0,c.createElement)("h1",{className:"content-restriction__integrations__header__title"},(0,E.__)("Integrations","content-restriction")),(0,c.createElement)("p",null,(0,E.__)("Seamlessly integrate with other plugins to enhance your website’s content visibility and control functionality. Use advanced conditional rules to create a more personalized user experience.","content-restriction"))),(0,c.createElement)($,null)))}function ee(){return(0,c.createElement)(c.Fragment,null,(0,c.createElement)(w,null),(0,c.createElement)(V,null))}var te=n(5448);const{TextArea:ne}=k.A,{Option:ce}=A.A,{Sider:re,Content:ae}=te.A,{TextArea:ie}=k.A,se=function(){return(0,c.createElement)(c.Fragment,null,(0,c.createElement)(r.I9,null,(0,c.createElement)(a.BV,null,(0,c.createElement)(a.qh,{path:"/",element:(0,c.createElement)(K,null)}),(0,c.createElement)(a.qh,{path:"/rules",element:(0,c.createElement)(K,null)}),(0,c.createElement)(a.qh,{path:"/rule",element:(0,c.createElement)(W,null)}),(0,c.createElement)(a.qh,{path:"/rule/:id",element:(0,c.createElement)(ee,null)}),(0,c.createElement)(a.qh,{path:"/integrations",element:(0,c.createElement)(q,null)}))))}}}]);
  • content-restriction/trunk/assets/dashboard-app.asset.php

    r3199191 r3294741  
    1 <?php return array('dependencies' => array('react', 'react-dom', 'wp-api-fetch', 'wp-data', 'wp-element', 'wp-i18n'), 'version' => 'e56767fde22f3d0ea646');
     1<?php return array('dependencies' => array('react', 'react-dom', 'wp-api-fetch', 'wp-data', 'wp-element', 'wp-i18n'), 'version' => '4f59a0fee0c4786e753e');
  • content-restriction/trunk/assets/dashboard-app.js

    r3199191 r3294741  
    1 (()=>{"use strict";var e,t,r={1609:e=>{e.exports=window.React},5795:e=>{e.exports=window.ReactDOM},1455:e=>{e.exports=window.wp.apiFetch},7143:e=>{e.exports=window.wp.data},6087:e=>{e.exports=window.wp.element},7723:e=>{e.exports=window.wp.i18n}},n={};function o(e){var t=n[e];if(void 0!==t)return t.exports;var a=n[e]={exports:{}};return r[e](a,a.exports,o),a.exports}o.m=r,o.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return o.d(t,{a:t}),t},o.d=(e,t)=>{for(var r in t)o.o(t,r)&&!o.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},o.f={},o.e=e=>Promise.all(Object.keys(o.f).reduce(((t,r)=>(o.f[r](e,t),t)),[])),o.u=e=>e+".js?ver=1732849392540",o.miniCssF=e=>e+".css",o.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),o.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),e={},t="content-restriction:",o.l=(r,n,a,i)=>{if(e[r])e[r].push(n);else{var c,l;if(void 0!==a)for(var s=document.getElementsByTagName("script"),d=0;d<s.length;d++){var u=s[d];if(u.getAttribute("src")==r||u.getAttribute("data-webpack")==t+a){c=u;break}}c||(l=!0,(c=document.createElement("script")).charset="utf-8",c.timeout=120,o.nc&&c.setAttribute("nonce",o.nc),c.setAttribute("data-webpack",t+a),c.src=r),e[r]=[n];var p=(t,n)=>{c.onerror=c.onload=null,clearTimeout(m);var o=e[r];if(delete e[r],c.parentNode&&c.parentNode.removeChild(c),o&&o.forEach((e=>e(n))),t)return t(n)},m=setTimeout(p.bind(null,void 0,{type:"timeout",target:c}),12e4);c.onerror=p.bind(null,c.onerror),c.onload=p.bind(null,c.onload),l&&document.head.appendChild(c)}},o.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},(()=>{var e;o.g.importScripts&&(e=o.g.location+"");var t=o.g.document;if(!e&&t&&(t.currentScript&&"SCRIPT"===t.currentScript.tagName.toUpperCase()&&(e=t.currentScript.src),!e)){var r=t.getElementsByTagName("script");if(r.length)for(var n=r.length-1;n>-1&&(!e||!/^http(s?):/.test(e));)e=r[n--].src}if(!e)throw new Error("Automatic publicPath is not supported in this browser");e=e.replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),o.p=e})(),(()=>{if("undefined"!=typeof document){var e={699:0};o.f.miniCss=(t,r)=>{e[t]?r.push(e[t]):0!==e[t]&&{704:1}[t]&&r.push(e[t]=(e=>new Promise(((t,r)=>{var n=o.miniCssF(e),a=o.p+n;if(((e,t)=>{for(var r=document.getElementsByTagName("link"),n=0;n<r.length;n++){var o=(i=r[n]).getAttribute("data-href")||i.getAttribute("href");if("stylesheet"===i.rel&&(o===e||o===t))return i}var a=document.getElementsByTagName("style");for(n=0;n<a.length;n++){var i;if((o=(i=a[n]).getAttribute("data-href"))===e||o===t)return i}})(n,a))return t();((e,t,r,n,a)=>{var i=document.createElement("link");i.rel="stylesheet",i.type="text/css",o.nc&&(i.nonce=o.nc),i.onerror=i.onload=r=>{if(i.onerror=i.onload=null,"load"===r.type)n();else{var o=r&&r.type,c=r&&r.target&&r.target.href||t,l=new Error("Loading CSS chunk "+e+" failed.\n("+o+": "+c+")");l.name="ChunkLoadError",l.code="CSS_CHUNK_LOAD_FAILED",l.type=o,l.request=c,i.parentNode&&i.parentNode.removeChild(i),a(l)}},i.href=t,document.head.appendChild(i)})(e,a,0,t,r)})))(t).then((()=>{e[t]=0}),(r=>{throw delete e[t],r})))}}})(),(()=>{var e={699:0};o.f.j=(t,r)=>{var n=o.o(e,t)?e[t]:void 0;if(0!==n)if(n)r.push(n[2]);else{var a=new Promise(((r,o)=>n=e[t]=[r,o]));r.push(n[2]=a);var i=o.p+o.u(t),c=new Error;o.l(i,(r=>{if(o.o(e,t)&&(0!==(n=e[t])&&(e[t]=void 0),n)){var a=r&&("load"===r.type?"missing":r.type),i=r&&r.target&&r.target.src;c.message="Loading chunk "+t+" failed.\n("+a+": "+i+")",c.name="ChunkLoadError",c.type=a,c.request=i,n[1](c)}}),"chunk-"+t,t)}};var t=(t,r)=>{var n,a,i=r[0],c=r[1],l=r[2],s=0;if(i.some((t=>0!==e[t]))){for(n in c)o.o(c,n)&&(o.m[n]=c[n]);l&&l(o)}for(t&&t(r);s<i.length;s++)a=i[s],o.o(e,a)&&e[a]&&e[a][0](),e[a]=0},r=self.webpackChunkcontent_restriction=self.webpackChunkcontent_restriction||[];r.forEach(t.bind(null,0)),r.push=t.bind(null,r.push.bind(r))})();var a=o(1609),i=o(6087),c=o(7723);const l=()=>(0,a.createElement)("div",{className:"content-restriction__preloader"},(0,c.__)("Content Restriction Dashboard Loading...","content-restriction")),s=(0,i.lazy)((()=>Promise.all([o.e(305),o.e(704)]).then(o.bind(o,6704))));document.addEventListener("DOMContentLoaded",(function(){const e=document.getElementById("content-restriction-admin-dashboard-app");e&&function(e){i.createRoot?(0,i.createRoot)(e).render((0,a.createElement)("div",{class:"content-restriction"},(0,a.createElement)(i.Suspense,{fallback:(0,a.createElement)(l,null)},(0,a.createElement)(s,null)))):render((0,a.createElement)("div",{class:"content-restriction"},(0,a.createElement)(i.Suspense,{fallback:(0,a.createElement)(l,null)},(0,a.createElement)(s,null))),e)}(e)}))})();
     1(()=>{"use strict";var e,t,r={1455:e=>{e.exports=window.wp.apiFetch},1609:e=>{e.exports=window.React},5795:e=>{e.exports=window.ReactDOM},6087:e=>{e.exports=window.wp.element},7143:e=>{e.exports=window.wp.data},7723:e=>{e.exports=window.wp.i18n}},n={};function o(e){var t=n[e];if(void 0!==t)return t.exports;var a=n[e]={exports:{}};return r[e](a,a.exports,o),a.exports}o.m=r,o.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return o.d(t,{a:t}),t},o.d=(e,t)=>{for(var r in t)o.o(t,r)&&!o.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},o.f={},o.e=e=>Promise.all(Object.keys(o.f).reduce(((t,r)=>(o.f[r](e,t),t)),[])),o.u=e=>e+".js?ver=1747395727611",o.miniCssF=e=>e+".css",o.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),o.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),e={},t="content-restriction:",o.l=(r,n,a,i)=>{if(e[r])e[r].push(n);else{var l,c;if(void 0!==a)for(var s=document.getElementsByTagName("script"),d=0;d<s.length;d++){var u=s[d];if(u.getAttribute("src")==r||u.getAttribute("data-webpack")==t+a){l=u;break}}l||(c=!0,(l=document.createElement("script")).charset="utf-8",l.timeout=120,o.nc&&l.setAttribute("nonce",o.nc),l.setAttribute("data-webpack",t+a),l.src=r),e[r]=[n];var p=(t,n)=>{l.onerror=l.onload=null,clearTimeout(m);var o=e[r];if(delete e[r],l.parentNode&&l.parentNode.removeChild(l),o&&o.forEach((e=>e(n))),t)return t(n)},m=setTimeout(p.bind(null,void 0,{type:"timeout",target:l}),12e4);l.onerror=p.bind(null,l.onerror),l.onload=p.bind(null,l.onload),c&&document.head.appendChild(l)}},o.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},(()=>{var e;o.g.importScripts&&(e=o.g.location+"");var t=o.g.document;if(!e&&t&&(t.currentScript&&"SCRIPT"===t.currentScript.tagName.toUpperCase()&&(e=t.currentScript.src),!e)){var r=t.getElementsByTagName("script");if(r.length)for(var n=r.length-1;n>-1&&(!e||!/^http(s?):/.test(e));)e=r[n--].src}if(!e)throw new Error("Automatic publicPath is not supported in this browser");e=e.replace(/^blob:/,"").replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),o.p=e})(),(()=>{if("undefined"!=typeof document){var e={699:0};o.f.miniCss=(t,r)=>{e[t]?r.push(e[t]):0!==e[t]&&{704:1}[t]&&r.push(e[t]=(e=>new Promise(((t,r)=>{var n=o.miniCssF(e),a=o.p+n;if(((e,t)=>{for(var r=document.getElementsByTagName("link"),n=0;n<r.length;n++){var o=(i=r[n]).getAttribute("data-href")||i.getAttribute("href");if("stylesheet"===i.rel&&(o===e||o===t))return i}var a=document.getElementsByTagName("style");for(n=0;n<a.length;n++){var i;if((o=(i=a[n]).getAttribute("data-href"))===e||o===t)return i}})(n,a))return t();((e,t,r,n,a)=>{var i=document.createElement("link");i.rel="stylesheet",i.type="text/css",o.nc&&(i.nonce=o.nc),i.onerror=i.onload=r=>{if(i.onerror=i.onload=null,"load"===r.type)n();else{var o=r&&r.type,l=r&&r.target&&r.target.href||t,c=new Error("Loading CSS chunk "+e+" failed.\n("+o+": "+l+")");c.name="ChunkLoadError",c.code="CSS_CHUNK_LOAD_FAILED",c.type=o,c.request=l,i.parentNode&&i.parentNode.removeChild(i),a(c)}},i.href=t,document.head.appendChild(i)})(e,a,0,t,r)})))(t).then((()=>{e[t]=0}),(r=>{throw delete e[t],r})))}}})(),(()=>{var e={699:0};o.f.j=(t,r)=>{var n=o.o(e,t)?e[t]:void 0;if(0!==n)if(n)r.push(n[2]);else{var a=new Promise(((r,o)=>n=e[t]=[r,o]));r.push(n[2]=a);var i=o.p+o.u(t),l=new Error;o.l(i,(r=>{if(o.o(e,t)&&(0!==(n=e[t])&&(e[t]=void 0),n)){var a=r&&("load"===r.type?"missing":r.type),i=r&&r.target&&r.target.src;l.message="Loading chunk "+t+" failed.\n("+a+": "+i+")",l.name="ChunkLoadError",l.type=a,l.request=i,n[1](l)}}),"chunk-"+t,t)}};var t=(t,r)=>{var n,a,[i,l,c]=r,s=0;if(i.some((t=>0!==e[t]))){for(n in l)o.o(l,n)&&(o.m[n]=l[n]);c&&c(o)}for(t&&t(r);s<i.length;s++)a=i[s],o.o(e,a)&&e[a]&&e[a][0](),e[a]=0},r=globalThis.webpackChunkcontent_restriction=globalThis.webpackChunkcontent_restriction||[];r.forEach(t.bind(null,0)),r.push=t.bind(null,r.push.bind(r))})();var a=o(1609),i=o(6087),l=o(7723);const c=()=>(0,a.createElement)("div",{className:"content-restriction__preloader"},(0,l.__)("Content Restriction Dashboard Loading...","content-restriction")),s=(0,i.lazy)((()=>Promise.all([o.e(493),o.e(704)]).then(o.bind(o,6704))));document.addEventListener("DOMContentLoaded",(function(){const e=document.getElementById("content-restriction-admin-dashboard-app");e&&function(e){i.createRoot?(0,i.createRoot)(e).render((0,a.createElement)("div",{class:"content-restriction"},(0,a.createElement)(i.Suspense,{fallback:(0,a.createElement)(c,null)},(0,a.createElement)(s,null)))):render((0,a.createElement)("div",{class:"content-restriction"},(0,a.createElement)(i.Suspense,{fallback:(0,a.createElement)(c,null)},(0,a.createElement)(s,null))),e)}(e)}))})();
  • content-restriction/trunk/config.php

    r3199191 r3294741  
    44
    55return [
    6     'version'     => '1.3.2',
     6    'version'     => '1.4.0',
    77    'min_php'     => '7.4',
    88    'db_version'  => '1.0.0',
  • content-restriction/trunk/content-restriction.php

    r3199191 r3294741  
    66 * Plugin URI: https://wordpress.org/plugins/content-restriction/
    77 * Description: Content Restriction - A simple and user-friendly plugin to restrict users / visitors from viewing posts by restricting access, as simple as that.
    8  * Version: 1.3.2
     8 * Version: 1.4.0
    99 * Author: ContentRestriction.com
    1010 * Author URI: https://contentrestriction.com/?utm_source=wp-plugins&utm_campaign=author-uri&utm_medium=wp-dash
  • content-restriction/trunk/languages/content-restriction.pot

    r3199191 r3294741  
    1 # Copyright (C) 2024 ContentRestriction.com
     1# Copyright (C) 2025 ContentRestriction.com
    22# This file is distributed under the GPLv2 or later.
    33msgid ""
    44msgstr ""
    5 "Project-Id-Version: All-in-One Content Restriction 1.3.2\n"
     5"Project-Id-Version: All-in-One Content Restriction 1.4.0\n"
    66"Report-Msgid-Bugs-To: "
    77"https://wordpress.org/support/plugin/content-restriction\n"
    8 "POT-Creation-Date: 2024-11-29 03:03:34+00:00\n"
     8"POT-Creation-Date: 2025-05-16 11:42:26+00:00\n"
    99"MIME-Version: 1.0\n"
    1010"Content-Type: text/plain; charset=utf-8\n"
    1111"Content-Transfer-Encoding: 8bit\n"
    12 "PO-Revision-Date: 2024-MO-DA HO:MI+ZONE\n"
     12"PO-Revision-Date: 2025-MO-DA HO:MI+ZONE\n"
    1313"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
    1414"Language-Team: LANGUAGE <LL@li.org>\n"
     
    111111#: app/Integrations/EasyDigitalDownloads/Frontend.php:65
    112112#: app/Integrations/WooCommerce/Frontend.php:67
    113 #: app/Modules/Posts/Frontend.php:49
     113#: app/Modules/Posts/Frontend.php:52
    114114msgid "Select Categories"
    115115msgstr ""
     
    345345msgstr ""
    346346
    347 #: app/Modules/Blur/Frontend.php:26 app/Modules/Randomize/Frontend.php:25
     347#: app/Modules/Blur/Frontend.php:27 app/Modules/Randomize/Frontend.php:26
    348348msgid "Apply To"
    349349msgstr ""
    350350
    351 #: app/Modules/Blur/Frontend.php:29 app/Modules/Randomize/Frontend.php:28
    352 #: app/Modules/Replace/Frontend.php:27
     351#: app/Modules/Blur/Frontend.php:30 app/Modules/Randomize/Frontend.php:29
     352#: app/Modules/Replace/Frontend.php:28
    353353msgid "Title"
    354354msgstr ""
    355355
    356 #: app/Modules/Blur/Frontend.php:30 app/Modules/Randomize/Frontend.php:29
    357 #: app/Modules/Replace/Frontend.php:32
     356#: app/Modules/Blur/Frontend.php:31 app/Modules/Randomize/Frontend.php:30
     357#: app/Modules/Replace/Frontend.php:33
    358358msgid "Content"
    359359msgstr ""
    360360
    361 #: app/Modules/Blur/Frontend.php:31 app/Modules/Randomize/Frontend.php:30
    362 #: app/Modules/Replace/Frontend.php:37
     361#: app/Modules/Blur/Frontend.php:32 app/Modules/Randomize/Frontend.php:31
     362#: app/Modules/Replace/Frontend.php:38
    363363msgid "Excerpt"
    364364msgstr ""
    365365
    366 #: app/Modules/Blur/Frontend.php:35
     366#: app/Modules/Blur/Frontend.php:36
    367367msgid "Level"
    368368msgstr ""
    369369
    370 #: app/Modules/Blur/Frontend.php:40
     370#: app/Modules/Blur/Frontend.php:41
    371371msgid "Spread"
    372372msgstr ""
     
    396396msgstr ""
    397397
    398 #: app/Modules/Pages/Frontend.php:27
     398#: app/Modules/Pages/Frontend.php:28
    399399msgid "Specific Page"
    400400msgstr ""
    401401
    402 #: app/Modules/Pages/Frontend.php:30
     402#: app/Modules/Pages/Frontend.php:31
    403403msgid "Specific page will be accessible when the set rule is applied."
    404404msgstr ""
    405405
    406 #: app/Modules/Pages/Frontend.php:34
     406#: app/Modules/Pages/Frontend.php:36
    407407msgid "Selected Pages"
    408408msgstr ""
    409409
    410 #: app/Modules/Pages/Frontend.php:42
     410#: app/Modules/Pages/Frontend.php:44
    411411msgid "Frontpage"
    412412msgstr ""
    413413
    414 #: app/Modules/Pages/Frontend.php:45
     414#: app/Modules/Pages/Frontend.php:47
    415415msgid "Frontpage will be accessible when the set rule is applied."
    416416msgstr ""
     
    424424msgstr ""
    425425
    426 #: app/Modules/Posts/Frontend.php:27
     426#: app/Modules/Posts/Frontend.php:28
    427427msgid "Specific Post"
    428428msgstr ""
    429429
    430 #: app/Modules/Posts/Frontend.php:30
     430#: app/Modules/Posts/Frontend.php:31
    431431msgid "Specific post will be accessible when the set rule is applied."
    432432msgstr ""
    433433
    434 #: app/Modules/Posts/Frontend.php:34
     434#: app/Modules/Posts/Frontend.php:36
    435435msgid "Select Posts"
    436436msgstr ""
    437437
    438 #: app/Modules/Posts/Frontend.php:42
     438#: app/Modules/Posts/Frontend.php:44
    439439msgid "Posts With Categories"
    440440msgstr ""
    441441
    442 #: app/Modules/Posts/Frontend.php:45
     442#: app/Modules/Posts/Frontend.php:47
    443443msgid "Post with the category will be accessible when the set rule is applied."
    444444msgstr ""
    445445
    446 #: app/Modules/Posts/Frontend.php:57
     446#: app/Modules/Posts/Frontend.php:60
    447447msgid "Posts With Tags"
    448448msgstr ""
    449449
    450 #: app/Modules/Posts/Frontend.php:60
     450#: app/Modules/Posts/Frontend.php:63
    451451msgid "Post with the tag will be accessible when the set rule is applied."
    452452msgstr ""
    453453
    454 #: app/Modules/Posts/Frontend.php:64
     454#: app/Modules/Posts/Frontend.php:68
    455455msgid "Select Tags"
    456456msgstr ""
     
    472472msgstr ""
    473473
    474 #: app/Modules/Redirection/Frontend.php:27
     474#: app/Modules/Redirection/Frontend.php:28
    475475msgid "Redirection to"
    476476msgstr ""
    477477
    478 #: app/Modules/Redirection/Frontend.php:28 app/Modules/Replace/Frontend.php:28
     478#: app/Modules/Redirection/Frontend.php:29 app/Modules/Replace/Frontend.php:29
    479479msgid "Title is a plugin that allows you to blur content on your site."
    480480msgstr ""
     
    488488msgstr ""
    489489
    490 #: app/Modules/Replace/Frontend.php:33
     490#: app/Modules/Replace/Frontend.php:34
    491491msgid "Randomize is a plugin that allows you to blur content on your site."
    492492msgstr ""
    493493
    494 #: app/Modules/Replace/Frontend.php:38
     494#: app/Modules/Replace/Frontend.php:39
    495495msgid "Excerpt is a plugin that allows you to blur content on your site."
     496msgstr ""
     497
     498#: app/Modules/Shortcode/Frontend.php:26
     499msgid "Shortcode"
     500msgstr ""
     501
     502#: app/Modules/Shortcode/Frontend.php:29
     503msgid "All the shortcode area will be accessible when the set rule is applied."
    496504msgstr ""
    497505
     
    501509
    502510#: app/Modules/WordPressUsers/Frontend.php:24
    503 #: app/Modules/WordPressUsers/Frontend.php:40
     511#: app/Modules/WordPressUsers/Frontend.php:41
    504512msgid "Select who should have access to the content."
    505513msgstr ""
    506514
    507 #: app/Modules/WordPressUsers/Frontend.php:28
     515#: app/Modules/WordPressUsers/Frontend.php:29
    508516msgid "Select Roles"
    509517msgstr ""
    510518
    511 #: app/Modules/WordPressUsers/Frontend.php:36
     519#: app/Modules/WordPressUsers/Frontend.php:37
    512520msgid "User Name"
    513521msgstr ""
    514522
    515 #: app/Modules/WordPressUsers/Frontend.php:44
     523#: app/Modules/WordPressUsers/Frontend.php:46
    516524msgid "Select Users"
    517525msgstr ""
    518526
    519 #: app/Modules/WordPressUsers/Frontend.php:52
     527#: app/Modules/WordPressUsers/Frontend.php:54
    520528msgid "Logged In User"
    521529msgstr ""
    522530
    523 #: app/Modules/WordPressUsers/Frontend.php:55
     531#: app/Modules/WordPressUsers/Frontend.php:57
    524532msgid "Only logged in user should have access to the content."
    525533msgstr ""
    526534
    527 #: app/Modules/WordPressUsers/Frontend.php:59
     535#: app/Modules/WordPressUsers/Frontend.php:62
    528536msgid "Logged Out User"
    529537msgstr ""
    530538
    531 #: app/Modules/WordPressUsers/Frontend.php:62
     539#: app/Modules/WordPressUsers/Frontend.php:65
    532540msgid "Only logged out user should have access to the content."
    533541msgstr ""
  • content-restriction/trunk/readme.txt

    r3199191 r3294741  
    11=== All-in-One Content Restriction – Conditional Content Visibility & Access Control for WordPress ===
    2 Contributors: Pluginly, HeyMehedi
    3 Tags: content restriction, access control, private, permission, restrict access
     2Contributors: pluginly, heymehedi
     3Tags: content restriction, restrict access, user permissions, conditional content, membership
    44Requires at least: 5.6
    5 Tested up to: 6.6.2
     5Tested up to: 6.8
    66Requires PHP: 7.4
    7 Stable tag: 1.3.2
     7Stable tag: 1.4.0
    88License: GPLv2 or later
    99License URI: https://www.gnu.org/licenses/gpl-2.0.html
    1010
    11 All-in-One Content Restriction is a comprehensive, easy to use & feature-packed WordPress content restriction plugin.
     11Take control of your content. Restrict any post, page, or custom content based on user roles, login state, or custom rules. No code needed.
    1212
    1313== Description ==
    14 All-in-One Content Restriction is a comprehensive, easy to use & feature-packed WordPress content restriction plugin to set content access rules for any user - whether logged in, holding specific user role, or a visitor.
    1514
    16 Decide who gets to see what content – be it pages, posts , taxonomy or any custom post type by setting up content visibility rules.
     15**Who sees what? You decide.**
    1716
    18 You can transform any static content into conditional and personalized content.
     17All-in-One Content Restriction is the ultimate WordPress plugin for managing who can access which parts of your site – posts, pages, taxonomies, custom post types, you name it.
    1918
    20 Unlock all features with [Content Restriction Pro](https://contentrestriction.com/?utm_source=wp-plugins&utm_campaign=author-uri&utm_medium=wp-dash).
     19Whether you're building a members-only area, hiding content from guests, or creating a personalized experience for logged-in users — this plugin lets you define visibility rules in a few clicks.
    2120
    22 = Restrict any content in seconds!⏱️ =
    23 This plugin is intently built with the non-technical users in mind.You have complete control over who can access your website's content and how it is protected.
     21🏆 Perfect for:
     22- Membership sites
     23- Online courses
     24- Premium content gating
     25- Multi-role intranets
     26- Custom user journeys
    2427
    25 It just takes **3 simple steps**:
     28> Want even more power? Unlock premium features with [Content Restriction Pro](https://contentrestriction.com/?utm_source=wp-plugins&utm_campaign=author-uri&utm_medium=wp-dash).
    2629
    27 1️⃣ **Set rules for content visibility:** Determine who can view the content
     30---
    2831
    29 2️⃣ **Unlock content based on permissions:** Specify what content will be accessible if a user meets the visibility criteria.
     32== 🚀 Features at a Glance ==
    3033
    31 3️⃣ **Protect content for unauthorized users:** Decide how the content should be restricted for users who do not meet the access permissions.
     34**🔐 Restriction Logic**
     35- Show/hide content based on:
     36  - Logged-in status
     37  - User roles
     38  - Specific usernames
     39  - Guest visitors
    3240
    33 = Features Spotlight =
     41**🧱 Content Coverage**
     42- Posts (individual or category/tag-based)
     43- Pages (including homepage)
     44- Custom post types
     45- Any taxonomy
    3446
    35 == Content Types ==
     47**🛑 Restriction Methods**
     48Choose what happens *when access is denied*:
     49- **Replace:** Swap content with a custom message
     50- **Hide:** Make it vanish completely
     51- **Login & Return:** Prompt login, then redirect back
     52- **Redirect:** Send users to another page (custom or predefined)
     53- **Blur:** Apply visual blur to titles, excerpts, or content
     54- **Obfuscate:** Garble text to hide meaning
    3655
    37 **Post**
    38 🔹 Restrict access to all posts.
    39 🔹 Restrict access to specific posts.
    40 🔹 Restrict access to posts in a specific category.
    41 🔹 Restrict access to posts with a specific tag.
     56---
    4257
    43 **Page**
    44 🔹 Restrict access to the homepage / front page.
    45 🔹 Restrict access to all pages.
    46 🔹 Restrict access to specific pages.
     58== 🎯 Built for Everyone ==
    4759
     60**Non-techies** can restrict content in seconds — no coding, no confusion.
    4861
    49 **Custom Content**
    50 Restrict access to any taxonomy & custom post type (CPT)
     62**Developers** get hooks, filters, and tight integration with popular plugins. Scale it however you like.
    5163
    52 == User Types ==
    53 🔹 Logged-in user
    54 🔹 Logged-out user
    55 🔹 User role
    56 🔹 Specific username
     64---
    5765
    58 == Restriction Types ==
    59 When a user does not have access permission, the following rules can be applied to control their experience:
     66== 📦 Integrations (Native Support) ==
    6067
    61 🔹 Replace: Replace the post or page title, excerpt, and description with a custom message.
    62 🔹 Hide: Hide the post or page entirely.
    63 🔹 Login & Return: Redirect the user back to the current post or page after they log in.
    64 🔹 Redirect: Redirect the post or page to the homepage, blog page, or a custom URL.
    65 🔹 Blur: Blur the post or page title, excerpt, and description.
    66 🔹 Obfuscate: Randomize words in the post or page title, excerpt, and description.
     68✅ WooCommerce 
     69✅ Easy Digital Downloads 
     70✅ FluentCRM 
     71✅ Directorist 
     72✅ Login Me Now 
    6773
     74🛠 Coming soon:
     75- ACF (Advanced Custom Fields)
     76- Elementor
     77- BuddyPress
     78- BuddyBoss
     79- Tutor LMS
     80- LearnDash
    6881
    69 == Direct Integrations ==
    70 🔹 WooCommerce
    71 🔹 Easy Digital Downloads
    72 🔹 FluentCRM
    73 🔹 Directorist
    74 🔹 Login Me Now
    75 🔹 ACF - Advanced Custom Fields (Upcoming)
    76 🔹 BuddyPress (Upcoming)
    77 🔹 BuddyBoss (Upcoming)
    78 🔹 Elementor (Upcoming)
    79 🔹 TutorLMS (Upcoming)
    80 🔹 Learndash (Upcoming)
     82---
    8183
     84== 🧩 Other Plugins by Us ==
    8285
    83 = OTHER AMAZING PLUGIN BY US =
    84 [Login Me Now](https://wordpress.org/plugins/login-me-now/)
     86🔥 [Login Me Now](https://wordpress.org/plugins/login-me-now/) — Passwordless login, user switching, email magic links, and more.
    8587
    86 = FIND AN ISSUE? =
     88---
    8789
    88 We are right here to help you in [support forum](https://wordpress.org/support/plugin/content-restriction/). You can post a topic. Please search existing topics before starting a new one.
     90== 📥 Installation ==
    8991
     921. Upload the plugin files to `/wp-content/plugins/content-restriction`, or install via the WordPress Plugin Directory.
     932. Activate the plugin through the "Plugins" screen in WordPress.
     943. Start setting rules under the "Content Restriction" menu.
    9095
    91 == Installation ==
    92 Install Content Restriction either via the WordPress.org plugin repository or by uploading the files to your server.
     96---
    9397
    9498== Frequently Asked Questions ==
    9599
    96 = Will content restriction work with my theme? =
    97 Yes! This plugin works with most theme out-of-the-box. However some themes may need adjustments due to not using WordPress/WooCommerce standard hooks or styles or if they add their own customizations which might conflict with Content Restriction.
     100= Will it work with my theme? = 
     101Yes, Content Restriction works with most well-coded WordPress themes. If something looks off, hit us up in the [support forum](https://wordpress.org/support/plugin/content-restriction/) — we’re on it.
    98102
    99 **If you have any issues using Content Restriction with your theme please let us know through the [support forum](https://wordpress.org/support/plugin/content-restriction/) and we’ll fix it asap.**
     103= Does it protect media files like images or videos? = 
     104It restricts the *display* of embedded media in posts/pages, but direct media URLs can still be accessed unless protected via server-level rules.
    100105
    101 = Is content restriction  compliant with privacy laws (GDPR / RGPD / CCPA / LGPD)? =
    102 We value your privacy and your customers’ privacy.
     106= Is it privacy-compliant (GDPR / CCPA / etc.)? = 
     107We do not collect any personal data or track users. You’re in full control. If we ever request anonymous usage data, you’ll have the option to opt in.
    103108
    104 While we cannot guarantee that the plugin is fully compliant with privacy laws in every country.
     109= Do I need to create an account? = 
     110Nope. Everything lives securely in your WordPress dashboard. No 3rd-party accounts or logins needed.
    105111
    106 **We assure you that Fluid Checkout does not, and will not, collect any customer data from your shop.**
     112---
    107113
    108 In the future, **and with your explicit consent**, we might collect some non-sensitive usage data from your website such as the plugin and WooCommerce settings, which other plugins and themes you have installed on your shop to help us to improve the plugin stability.
     114== 🛠 Need Help? ==
    109115
    110 Details and examples of the data collected will be shown on the plugin interface for you to review prior to sending the data to our servers for collection and storage.
     116We monitor the [support forum](https://wordpress.org/support/plugin/content-restriction/) actively — drop your questions there. Please search before creating a new topic to avoid duplicates.
    111117
    112 = Does the plugin protect images, videos and other media files? =
    113 Yes. Content Restriction can restrict access to media that is embedded within a post or page, but it does not protect the original file URL on the server.
     118---
    114119
    115 = Do I need to create a account to use the plugin? =
    116 No you don’t have to create account to use this plugin. Gated content rules setup & membership data live securely within the central WordPress dashboard of your website.
     120== 🧾 Changelog ==
    117121
    118 
    119 == Changelog ==
    120 
     122= 1.4.0 – May 16, 2024 =
     123* New: Shortcode Module
    121124
    122125= 1.3.2 – Nov 29, 2024 =
    123 * Fix: Translation Warning Issue   
     126* Fix: Translation Warning Issue
    124127
    125128= 1.3.1 – Nov 26, 2024 =
    126 * Add: Hook - content_restriction_module_condition_check_before
     129* Add: Hook - `content_restriction_module_condition_check_before`
    127130
    128131= 1.3.0 – Nov 4, 2024 =
    129 * New: Integrations Page Added
    130 * Improve: Add User Consent
    131 * Improve: Changed Default Status
    132 * Announce: PRO Released
     132* New: Integrations Page
     133* Improve: User Consent UI
     134* Improve: Default Visibility Behavior
     135* Launch: PRO Version Announcement
    133136
    134137= 1.2.2 – Sep 21, 2024 =
    135 * Fix: Login & Back Dashboard Error
     138* Fix: Login & Dashboard Return Bug
    136139
    137140= 1.2.1 – Sep 19, 2024 =
    138 * Fix: Specific Post Hide Issue
    139 * Fix: Cache Issue for Dashboard
     141* Fix: Specific Post Visibility Issue
     142* Fix: Cache Conflict on Dashboard
    140143
    141144= 1.2.0 – Sep 7, 2024 =
    142145* Add: WooCommerce Subscription Integration
    143 * Fix: WooCommerce Error
     146* Fix: WooCommerce Display Issue
    144147
    145148= 1.1.1 – Aug 30, 2024 =
    146 * Fix: Hide Issue
     149* Fix: Content Hide Bug
    147150
    148151= 1.1.0 – Aug 27, 2024 =
    149 * Add: WooCommerce Integration
    150 * Add: Directorist Integration
    151 * Add: FluentCRM Integration
    152 * Add: Login Me Now Integration
    153 * Add: Easy Digital Downloads Integration
     152* Add: WooCommerce, Directorist, FluentCRM, Login Me Now, and EDD Integrations
    154153
    155154= 1.0.0 – Aug 18, 2024 =
  • content-restriction/trunk/vendor/autoload.php

    r3137277 r3294741  
    1515        }
    1616    }
    17     trigger_error(
    18         $err,
    19         E_USER_ERROR
    20     );
     17    throw new RuntimeException($err);
    2118}
    2219
  • content-restriction/trunk/vendor/composer/InstalledVersions.php

    r3137277 r3294741  
    2828{
    2929    /**
     30     * @var string|null if set (by reflection by Composer), this should be set to the path where this class is being copied to
     31     * @internal
     32     */
     33    private static $selfDir = null;
     34
     35    /**
    3036     * @var mixed[]|null
    3137     * @psalm-var array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>}|array{}|null
    3238     */
    3339    private static $installed;
     40
     41    /**
     42     * @var bool
     43     */
     44    private static $installedIsLocalDir;
    3445
    3546    /**
     
    310321        self::$installed = $data;
    311322        self::$installedByVendor = array();
     323
     324        // when using reload, we disable the duplicate protection to ensure that self::$installed data is
     325        // always returned, but we cannot know whether it comes from the installed.php in __DIR__ or not,
     326        // so we have to assume it does not, and that may result in duplicate data being returned when listing
     327        // all installed packages for example
     328        self::$installedIsLocalDir = false;
     329    }
     330
     331    /**
     332     * @return string
     333     */
     334    private static function getSelfDir()
     335    {
     336        if (self::$selfDir === null) {
     337            self::$selfDir = strtr(__DIR__, '\\', '/');
     338        }
     339
     340        return self::$selfDir;
    312341    }
    313342
     
    323352
    324353        $installed = array();
     354        $copiedLocalDir = false;
    325355
    326356        if (self::$canGetVendors) {
     357            $selfDir = self::getSelfDir();
    327358            foreach (ClassLoader::getRegisteredLoaders() as $vendorDir => $loader) {
     359                $vendorDir = strtr($vendorDir, '\\', '/');
    328360                if (isset(self::$installedByVendor[$vendorDir])) {
    329361                    $installed[] = self::$installedByVendor[$vendorDir];
     
    331363                    /** @var array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>} $required */
    332364                    $required = require $vendorDir.'/composer/installed.php';
    333                     $installed[] = self::$installedByVendor[$vendorDir] = $required;
    334                     if (null === self::$installed && strtr($vendorDir.'/composer', '\\', '/') === strtr(__DIR__, '\\', '/')) {
    335                         self::$installed = $installed[count($installed) - 1];
     365                    self::$installedByVendor[$vendorDir] = $required;
     366                    $installed[] = $required;
     367                    if (self::$installed === null && $vendorDir.'/composer' === $selfDir) {
     368                        self::$installed = $required;
     369                        self::$installedIsLocalDir = true;
    336370                    }
     371                }
     372                if (self::$installedIsLocalDir && $vendorDir.'/composer' === $selfDir) {
     373                    $copiedLocalDir = true;
    337374                }
    338375            }
     
    351388        }
    352389
    353         if (self::$installed !== array()) {
     390        if (self::$installed !== array() && !$copiedLocalDir) {
    354391            $installed[] = self::$installed;
    355392        }
  • content-restriction/trunk/vendor/composer/installed.php

    r3199191 r3294741  
    22    'root' => array(
    33        'name' => 'pluginly/content-restriction',
    4         'pretty_version' => '1.3.2',
    5         'version' => '1.3.2.0',
    6         'reference' => '2a472ba24ef373bc73c01573d5c5bd283ee44465',
     4        'pretty_version' => '1.4.0',
     5        'version' => '1.4.0.0',
     6        'reference' => 'bf4db08d4d0efa497dbfbfb2d7b71b1c2952bfe1',
    77        'type' => 'library',
    88        'install_path' => __DIR__ . '/../../',
     
    1212    'versions' => array(
    1313        'pluginly/content-restriction' => array(
    14             'pretty_version' => '1.3.2',
    15             'version' => '1.3.2.0',
    16             'reference' => '2a472ba24ef373bc73c01573d5c5bd283ee44465',
     14            'pretty_version' => '1.4.0',
     15            'version' => '1.4.0.0',
     16            'reference' => 'bf4db08d4d0efa497dbfbfb2d7b71b1c2952bfe1',
    1717            'type' => 'library',
    1818            'install_path' => __DIR__ . '/../../',
Note: See TracChangeset for help on using the changeset viewer.