<?php
$embeddedSignUpAddon = $isExtendedLicence = (getAppSettings('lwAddonWhatsJetEmbeddedSignUpAddon', 'registration_id') and (sha1(array_get($_SERVER, 'HTTP_HOST', '') . getAppSettings('lwAddonWhatsJetEmbeddedSignUpAddon','registration_id') . '1.0+') === getAppSettings('lwAddonWhatsJetEmbeddedSignUpAddon','signature')));
?>
<!-- Page Heading -->
<h1>
    <?= __tr('WhatsApp Onboarding Setup') ?>
</h1>
    <form class="lw-ajax-form lw-form" method="post"
            action="<?= route('manage.configuration.write', ['pageType' => 'manual_whatsapp_onboarding']) ?>" x-cloak>
            <fieldset>
                <legend><?php echo e(__tr('Manual Onboarding')); ?></legend>
                <div class="form-group">
                    <?php if (isset($component)) { $__componentOriginal85a79a3f590ffcc2d6473eb3120eb493 = $component; } ?>
<?php if (isset($attributes)) { $__attributesOriginal85a79a3f590ffcc2d6473eb3120eb493 = $attributes; } ?>
<?php $component = Illuminate\View\AnonymousComponent::resolve(['view' => 'components.lw.checkbox','data' => ['id' => 'lwEnableManualWhatsAppSignup','name' => 'enable_whatsapp_manual_signup','offValue' => 0,'dataLwPlugin' => 'lwSwitchery','checked' => getAppSettings('enable_whatsapp_manual_signup'),'label' => __tr('Enable Manual WhatsApp Onboarding')]] + (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag ? $attributes->all() : [])); ?>
<?php $component->withName('lw.checkbox'); ?>
<?php if ($component->shouldRender()): ?>
<?php $__env->startComponent($component->resolveView(), $component->data()); ?>
<?php if (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag): ?>
<?php $attributes = $attributes->except(\Illuminate\View\AnonymousComponent::ignoredParameterNames()); ?>
<?php endif; ?>
<?php $component->withAttributes(['id' => 'lwEnableManualWhatsAppSignup','name' => 'enable_whatsapp_manual_signup','offValue' => 0,'data-lw-plugin' => 'lwSwitchery','checked' => \Illuminate\View\Compilers\BladeCompiler::sanitizeComponentAttribute(getAppSettings('enable_whatsapp_manual_signup')),'label' => \Illuminate\View\Compilers\BladeCompiler::sanitizeComponentAttribute(__tr('Enable Manual WhatsApp Onboarding'))]); ?>
<?php echo $__env->renderComponent(); ?>
<?php endif; ?>
<?php if (isset($__attributesOriginal85a79a3f590ffcc2d6473eb3120eb493)): ?>
<?php $attributes = $__attributesOriginal85a79a3f590ffcc2d6473eb3120eb493; ?>
<?php unset($__attributesOriginal85a79a3f590ffcc2d6473eb3120eb493); ?>
<?php endif; ?>
<?php if (isset($__componentOriginal85a79a3f590ffcc2d6473eb3120eb493)): ?>
<?php $component = $__componentOriginal85a79a3f590ffcc2d6473eb3120eb493; ?>
<?php unset($__componentOriginal85a79a3f590ffcc2d6473eb3120eb493); ?>
<?php endif; ?>
                </div>
                <div class="form-group">
                    
                    <button type="submit" href class="btn btn-primary btn-user lw-btn-block-mobile">
                        <?= __tr('Save') ?>
                    </button>
                </div>
            </fieldset>
            </form>
            <form class="lw-ajax-form lw-form" method="post"
            action="<?= route('manage.configuration.write', ['pageType' => 'whatsapp_onboarding']) ?>" x-cloak
            x-data="{embeddedSignUpDataExists: <?php echo e(getAppSettings('embedded_signup_app_id') ? 1 : 0); ?>}">
            <fieldset x-data="{openEmbeddedHelp:false}" x-cloak >
                <legend><i class="fab fa-facebook"></i> <?php echo e(__tr('Embedded Signup Onboarding')); ?></legend>
                <fieldset>
                    <legend @click="openEmbeddedHelp = !openEmbeddedHelp"><?php echo e(__tr('Requirements and Information')); ?> <small class="text-muted"><?php echo e(__tr('Click to show/hide')); ?></small></legend>
                    <div x-show="openEmbeddedHelp">
                        <div class="row">
                            <div class="col-12">
                            <div class="float-right">
                            <a class="btn btn-info" href="https://developers.facebook.com/docs/whatsapp/embedded-signup/"  target="_blank"><?php echo e(__tr('More Information')); ?></a>
                            <a class="btn btn-info" href="https://developers.facebook.com/docs/whatsapp/solution-providers/get-started-for-tech-providers" class="float-right" target="_blank"><?php echo e(__tr('Get started for Tech Provider')); ?></a>
                        </div>
                            </div>
                        </div>
                    <dl>
                        <dt><?php echo e(__tr('Verified Meta Account')); ?></dt>
                        <dd><?php echo e(__tr('To use Embedded signup for onboarding your customers you should have Meta Verified account')); ?>

                        <div >
                            <a target="_blank" href="https://www.facebook.com/business/help/2058515294227817><?php echo e(__tr('How to verify?')); ?></a>
                        </div>
                        </dd>
                        <dt class="mt-4"><?php echo e(__tr('Become a Tech Provider')); ?></dt>
                        <dd><?php echo e(__tr('Follow the instructions on the given link to become tech provider so, your customers can use Embedded signup to get their account connected.')); ?>

                            <div>
                                <a target="_blank" href="https://developers.facebook.com/docs/whatsapp/solution-providers/get-started-for-tech-providers"><?php echo e(__tr('How to become Tech Provider?')); ?></a>
                            </div>
                            <div>
                                <h4><?php echo e(__tr('Once you become verified Tech provider all 3 items should shown in green checked mark')); ?></h4>
                                <div>
                                    <img src="<?php echo e(asset('imgs/help/tech-provider.png')); ?>" alt="">
                                </div>
                                <div class="text-danger my-3 border rounded border-danger p-3 col-sm-12 col-md-6">
                                    <strong><?php echo e(__tr('Important')); ?></strong>
                                    <p class="mt-2 font-weight-bold">
                                        <?php echo e(__tr('1) Along with whatsapp_business_management and whatsapp_business_messaging you also needs to get public_profile and email advanced permissions from requests permissions')); ?>

                                    </p>
                                    <p class="font-weight-bold">
                                        <?php echo e(__tr('2) You don\'t need to create Webhook manually on app id and app secret validation it will be created automatically.')); ?>

                                    </p>
                                </div>
                            </div>
                        </dd>
                        <dt class="mt-4"><?php echo e(__tr('Your are almost ready')); ?></dt>
                        <dd><?php echo e(__tr('You need to set App ID, App Secret and Config ID')); ?></a></dd>
                    </dl>
                    <div class="form-group col-sm-12 col-md-6 mb-4">
                        <hr>
                        <?php
                            $hostRoot = request()->root();
                        ?>
                        <label for="lwHostRoot"><?php echo e(__tr('You may need to allow following domain while configuring')); ?></label>
                        <div class="input-group">
                            <input type="text" class="form-control" readonly id="lwHostRoot" value="<?php echo e($hostRoot); ?>">
                            <div class="input-group-append">
                                <button class="btn btn-outline-light" type="button" onclick="lwCopyToClipboard('lwHostRoot')">
                                    <?= __tr('Copy') ?>
                                </button>
                            </div>
                        </div>
                        <?php if(!Str::startsWith($hostRoot, 'https://')): ?>
                            <div class="alert alert-danger my-3">
                                <?php echo e(__tr('Non https url may not accepted by Facebook.')); ?>

                            </div>
                        <?php endif; ?>
                    </div>
                    </div>
                </fieldset>
            <?php if(!$isExtendedLicence or isDemo()): ?>
                <div class="alert alert-warning my-3">
                    <strong><?= __tr('Embedded Signup Addon is Required') ?></strong> <br>
                    <?= __tr('To use Embedded Signup you need to have an Embedded Signup Addon.') ?>
                </div>
            <?php endif; ?>
            <?php if($isExtendedLicence): ?>
            <div x-show="embeddedSignUpDataExists"></div>
            <div class="form-group">
                <?php if (isset($component)) { $__componentOriginal85a79a3f590ffcc2d6473eb3120eb493 = $component; } ?>
<?php if (isset($attributes)) { $__attributesOriginal85a79a3f590ffcc2d6473eb3120eb493 = $attributes; } ?>
<?php $component = Illuminate\View\AnonymousComponent::resolve(['view' => 'components.lw.checkbox','data' => ['id' => 'lwEmbeddedSignupEnableField','name' => 'enable_embedded_signup','offValue' => 0,'dataLwPlugin' => 'lwSwitchery','checked' => getAppSettings('enable_embedded_signup'),'label' => __tr('Enable Embedded Signup')]] + (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag ? $attributes->all() : [])); ?>
<?php $component->withName('lw.checkbox'); ?>
<?php if ($component->shouldRender()): ?>
<?php $__env->startComponent($component->resolveView(), $component->data()); ?>
<?php if (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag): ?>
<?php $attributes = $attributes->except(\Illuminate\View\AnonymousComponent::ignoredParameterNames()); ?>
<?php endif; ?>
<?php $component->withAttributes(['id' => 'lwEmbeddedSignupEnableField','name' => 'enable_embedded_signup','offValue' => 0,'data-lw-plugin' => 'lwSwitchery','checked' => \Illuminate\View\Compilers\BladeCompiler::sanitizeComponentAttribute(getAppSettings('enable_embedded_signup')),'label' => \Illuminate\View\Compilers\BladeCompiler::sanitizeComponentAttribute(__tr('Enable Embedded Signup'))]); ?>
<?php echo $__env->renderComponent(); ?>
<?php endif; ?>
<?php if (isset($__attributesOriginal85a79a3f590ffcc2d6473eb3120eb493)): ?>
<?php $attributes = $__attributesOriginal85a79a3f590ffcc2d6473eb3120eb493; ?>
<?php unset($__attributesOriginal85a79a3f590ffcc2d6473eb3120eb493); ?>
<?php endif; ?>
<?php if (isset($__componentOriginal85a79a3f590ffcc2d6473eb3120eb493)): ?>
<?php $component = $__componentOriginal85a79a3f590ffcc2d6473eb3120eb493; ?>
<?php unset($__componentOriginal85a79a3f590ffcc2d6473eb3120eb493); ?>
<?php endif; ?>
            </div>
            <div class="alert alert-warning">
                <?php echo e(__tr('Please do not use the same app for any other purposes like Manual WhatsApp API Setup etc')); ?>

            </div>
            <div class="form-group" x-cloak x-show="embeddedSignUpDataExists">
                <div class="btn-group">
                    <button type="button" disabled="true" class="btn btn-success lw-btn">
                        <?php echo e(__tr('Embedded Signup Settings are exist')); ?>

                    </button>
                    <button type="button" @click="embeddedSignUpDataExists = !embeddedSignUpDataExists"
                        class="btn btn-light lw-btn"><?php echo e(__tr('Update')); ?></button>
                   <?php if(!isDemo()): ?>
                        <a class="btn btn-muted lw-btn" target="_blank" href="https://developers.facebook.com/apps/<?php echo e(getAppSettings('embedded_signup_app_id')); ?>/whatsapp-business/wa-settings"><?php echo e(__tr('Go to App')); ?> <i class="fas fa-external-link-alt"></i></a>
                   <?php endif; ?>
                </div>
            </div>
            <template x-if="!embeddedSignUpDataExists">
            <div x-show="!embeddedSignUpDataExists" class="col-sm-12 col-md-6 col-lg-4">
                <a target="_blank" href="https://developers.facebook.com/docs/whatsapp/cloud-api/get-started-for-tech-providers#step-2--create-a-meta-app" class="float-right btn btn-info btn-sm"><?php echo e(__tr('Help')); ?> <i class="fas fa-external-link-alt"></i></a>
                <?php if (isset($component)) { $__componentOriginalc48421d24039f3f08f3bb9a3b9254b69 = $component; } ?>
<?php if (isset($attributes)) { $__attributesOriginalc48421d24039f3f08f3bb9a3b9254b69 = $attributes; } ?>
<?php $component = Illuminate\View\AnonymousComponent::resolve(['view' => 'components.lw.input-field','data' => ['type' => 'text','id' => 'lwEmbeddedSignUpAppId','dataFormGroupClass' => '','label' => __tr('App ID'),'name' => 'embedded_signup_app_id']] + (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag ? $attributes->all() : [])); ?>
<?php $component->withName('lw.input-field'); ?>
<?php if ($component->shouldRender()): ?>
<?php $__env->startComponent($component->resolveView(), $component->data()); ?>
<?php if (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag): ?>
<?php $attributes = $attributes->except(\Illuminate\View\AnonymousComponent::ignoredParameterNames()); ?>
<?php endif; ?>
<?php $component->withAttributes(['type' => 'text','id' => 'lwEmbeddedSignUpAppId','data-form-group-class' => '','label' => \Illuminate\View\Compilers\BladeCompiler::sanitizeComponentAttribute(__tr('App ID')),'name' => 'embedded_signup_app_id']); ?>
<?php echo $__env->renderComponent(); ?>
<?php endif; ?>
<?php if (isset($__attributesOriginalc48421d24039f3f08f3bb9a3b9254b69)): ?>
<?php $attributes = $__attributesOriginalc48421d24039f3f08f3bb9a3b9254b69; ?>
<?php unset($__attributesOriginalc48421d24039f3f08f3bb9a3b9254b69); ?>
<?php endif; ?>
<?php if (isset($__componentOriginalc48421d24039f3f08f3bb9a3b9254b69)): ?>
<?php $component = $__componentOriginalc48421d24039f3f08f3bb9a3b9254b69; ?>
<?php unset($__componentOriginalc48421d24039f3f08f3bb9a3b9254b69); ?>
<?php endif; ?>
                <?php if (isset($component)) { $__componentOriginalc48421d24039f3f08f3bb9a3b9254b69 = $component; } ?>
<?php if (isset($attributes)) { $__attributesOriginalc48421d24039f3f08f3bb9a3b9254b69 = $attributes; } ?>
<?php $component = Illuminate\View\AnonymousComponent::resolve(['view' => 'components.lw.input-field','data' => ['type' => 'text','id' => 'lwEmbeddedSignUpAppSecret','dataFormGroupClass' => '','label' => __tr('App Secret'),'name' => 'embedded_signup_app_secret']] + (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag ? $attributes->all() : [])); ?>
<?php $component->withName('lw.input-field'); ?>
<?php if ($component->shouldRender()): ?>
<?php $__env->startComponent($component->resolveView(), $component->data()); ?>
<?php if (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag): ?>
<?php $attributes = $attributes->except(\Illuminate\View\AnonymousComponent::ignoredParameterNames()); ?>
<?php endif; ?>
<?php $component->withAttributes(['type' => 'text','id' => 'lwEmbeddedSignUpAppSecret','data-form-group-class' => '','label' => \Illuminate\View\Compilers\BladeCompiler::sanitizeComponentAttribute(__tr('App Secret')),'name' => 'embedded_signup_app_secret']); ?>
<?php echo $__env->renderComponent(); ?>
<?php endif; ?>
<?php if (isset($__attributesOriginalc48421d24039f3f08f3bb9a3b9254b69)): ?>
<?php $attributes = $__attributesOriginalc48421d24039f3f08f3bb9a3b9254b69; ?>
<?php unset($__attributesOriginalc48421d24039f3f08f3bb9a3b9254b69); ?>
<?php endif; ?>
<?php if (isset($__componentOriginalc48421d24039f3f08f3bb9a3b9254b69)): ?>
<?php $component = $__componentOriginalc48421d24039f3f08f3bb9a3b9254b69; ?>
<?php unset($__componentOriginalc48421d24039f3f08f3bb9a3b9254b69); ?>
<?php endif; ?>
                <a target="_blank" href="https://developers.facebook.com/docs/whatsapp/embedded-signup/embed-the-flow#step-2--create-facebook-login-for-business-configuration" class="float-right btn btn-info btn-sm mt-3"><?php echo e(__tr('Help')); ?> <i class="fas fa-external-link-alt"></i></a>
                <?php if (isset($component)) { $__componentOriginalc48421d24039f3f08f3bb9a3b9254b69 = $component; } ?>
<?php if (isset($attributes)) { $__attributesOriginalc48421d24039f3f08f3bb9a3b9254b69 = $attributes; } ?>
<?php $component = Illuminate\View\AnonymousComponent::resolve(['view' => 'components.lw.input-field','data' => ['type' => 'text','id' => 'lwEmbeddedSignUpConfigId','dataFormGroupClass' => '','label' => __tr('Config ID'),'name' => 'embedded_signup_config_id']] + (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag ? $attributes->all() : [])); ?>
<?php $component->withName('lw.input-field'); ?>
<?php if ($component->shouldRender()): ?>
<?php $__env->startComponent($component->resolveView(), $component->data()); ?>
<?php if (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag): ?>
<?php $attributes = $attributes->except(\Illuminate\View\AnonymousComponent::ignoredParameterNames()); ?>
<?php endif; ?>
<?php $component->withAttributes(['type' => 'text','id' => 'lwEmbeddedSignUpConfigId','data-form-group-class' => '','label' => \Illuminate\View\Compilers\BladeCompiler::sanitizeComponentAttribute(__tr('Config ID')),'name' => 'embedded_signup_config_id']); ?>
<?php echo $__env->renderComponent(); ?>
<?php endif; ?>
<?php if (isset($__attributesOriginalc48421d24039f3f08f3bb9a3b9254b69)): ?>
<?php $attributes = $__attributesOriginalc48421d24039f3f08f3bb9a3b9254b69; ?>
<?php unset($__attributesOriginalc48421d24039f3f08f3bb9a3b9254b69); ?>
<?php endif; ?>
<?php if (isset($__componentOriginalc48421d24039f3f08f3bb9a3b9254b69)): ?>
<?php $component = $__componentOriginalc48421d24039f3f08f3bb9a3b9254b69; ?>
<?php unset($__componentOriginalc48421d24039f3f08f3bb9a3b9254b69); ?>
<?php endif; ?>
            </div>
        </template>
        <fieldset class="form-group">
                <legend class="small"><?php echo e(__tr('Existing WhatsApp Business App')); ?></legend>
                <?php if (isset($component)) { $__componentOriginal85a79a3f590ffcc2d6473eb3120eb493 = $component; } ?>
<?php if (isset($attributes)) { $__attributesOriginal85a79a3f590ffcc2d6473eb3120eb493 = $attributes; } ?>
<?php $component = Illuminate\View\AnonymousComponent::resolve(['view' => 'components.lw.checkbox','data' => ['id' => 'lwBusinessAppOnboarding','name' => 'enable_business_app_onboarding','dataSize' => 'small','offValue' => 0,'dataLwPlugin' => 'lwSwitchery','checked' => getAppSettings('enable_business_app_onboarding'),'label' => __tr('Enable WhatsApp Business App Onboarding (aka Coexistence) using Embedded Signup')]] + (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag ? $attributes->all() : [])); ?>
<?php $component->withName('lw.checkbox'); ?>
<?php if ($component->shouldRender()): ?>
<?php $__env->startComponent($component->resolveView(), $component->data()); ?>
<?php if (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag): ?>
<?php $attributes = $attributes->except(\Illuminate\View\AnonymousComponent::ignoredParameterNames()); ?>
<?php endif; ?>
<?php $component->withAttributes(['id' => 'lwBusinessAppOnboarding','name' => 'enable_business_app_onboarding','data-size' => 'small','offValue' => 0,'data-lw-plugin' => 'lwSwitchery','checked' => \Illuminate\View\Compilers\BladeCompiler::sanitizeComponentAttribute(getAppSettings('enable_business_app_onboarding')),'label' => \Illuminate\View\Compilers\BladeCompiler::sanitizeComponentAttribute(__tr('Enable WhatsApp Business App Onboarding (aka Coexistence) using Embedded Signup'))]); ?>
<?php echo $__env->renderComponent(); ?>
<?php endif; ?>
<?php if (isset($__attributesOriginal85a79a3f590ffcc2d6473eb3120eb493)): ?>
<?php $attributes = $__attributesOriginal85a79a3f590ffcc2d6473eb3120eb493; ?>
<?php unset($__attributesOriginal85a79a3f590ffcc2d6473eb3120eb493); ?>
<?php endif; ?>
<?php if (isset($__componentOriginal85a79a3f590ffcc2d6473eb3120eb493)): ?>
<?php $component = $__componentOriginal85a79a3f590ffcc2d6473eb3120eb493; ?>
<?php unset($__componentOriginal85a79a3f590ffcc2d6473eb3120eb493); ?>
<?php endif; ?>
                <div class="text-warning help-text">
                   <em> <?php echo e(__tr('Please note once connected existing saved contacts on WhatsApp Business Mobile app will be synced but messages will not.')); ?></em>
                </div>
            </fieldset>
            <div class="form-group">
                
                <button type="submit" href class="btn btn-primary btn-user lw-btn-block-mobile">
                    <?= __tr('Save') ?>
                </button>
            </div>
            <?php endif; ?>
        </form>
    <?php $__env->startPush('appScripts'); ?>
    <script>
        "use strict";
    </script>
    <?php $__env->stopPush(); ?><?php /**PATH /home/agentkoncepts/public_html/resources/views/configuration/whatsapp-onboarding.blade.php ENDPATH**/ ?>