{$bot_url = 'https://app.shop-script.ru/s/%s/'}

{sprintf('[`Set up a mini-app online store within the %s messaging app. Your store seamlessly integrates with %s via a custom bot or a public channel and supports an in-mini-app checkout.`]', '[`MAX`]', '[`MAX`]')}

{sprintf('[`%s mini-app setup guide ›`]', '[`MAX`]')}

{if !empty($channel.id)} {else} {/if}
[`Enabled`]
{foreach $form_fields as $name => $control_html}
{$control_html}
{/foreach}

{sprintf('[`Your %s channel`]','[`MAX`]')}

{sprintf('[`Use Shop-Script bot for posting products’ BUY buttons to your public %s channel so that your subscribers can buy & check out right within the messenger.`]', '[`MAX`]')}

[`It’s free! There are no platform commissions for selling online via Shop-Script bot.`]

{sprintf('[`Your %s channel`]','[`MAX`]')}

[`Optional.`] Если у вас есть MAX-канал, введите его полный адрес (URL) вида https://max.ru/..., чтобы бот Shop-Script, предварительно добавленный в администраторы канала, мог публиковать в нем посты с кнопками «Купить».

{* link to Shop-Script master MAX bot *}
[`Shop-Script bot`]
https://max.ru/id7706505623_1_bot

[`Use this bot to publish posts with BUY buttons leading directly to your mini-app shopping experience.`]

{sprintf('[`To start posting, make sure %s is added as an admin to your %s public channel.`]', 'Shop-Script', '[`MAX`]')} {sprintf('[`%s mini-app setup guide ›`]', '[`MAX`]')}

{sprintf('[`Your %s custom bot`]','[`MAX`]')}

{sprintf_wp( 'An advanced option with a custom bot and your branding. In this mode, you will need to create your own %s bot using %s and link your store to that bot as a mini-app.', '[`MAX`]', 'href="https://business.max.ru" target="_blank"', '[`MAX for business`]' )}

[`If your custom bot token is connected, Shop-Script bot will automatically redirect all BUY buttons to your custom bot mini-app.`]

{if shopLicensing::isPremium()}{$_c = 0.75}{else}{$_c = 1.5}{/if} {sprintf_wp( '%s%% commission for orders processed via a custom bot. How it works ›', $_c|wa_format_number:2, sprintf( 'href="%s" target="_blank"', '[`https://www.shop-script.com/pricing/`]' ) )}

[`Your custom bot token`]
@{$channel.params.bot_username|default:''|escape} {$bot_state = ''} {if !empty($channel.params.bot_token)} {if empty($channel.params.bot_username)} {$bot_state = ' state-error-hint'} {else} {$bot_state = ' state-success-hint'} {/if} {/if}

{sprintf_wp( 'Create your custom MAX bot and obtain its token via MAX for business.', 'href="https://business.max.ru" target="_blank"' )}

{* custom bot mode mini-app URL *}
[`Mini-app URL`]
{if !$is_waid}

{sprintf('[`For the mini-app to work, enable Webasyst ID and services in the Settings app.`]', 'href="'|cat:$wa_backend_url|cat:'webasyst/settings/"')}

{elseif empty($channel.wa_channel_id)} [`Save this channel to get a link for your bot’s mini-app.`] {else} {sprintf($bot_url, $channel.wa_channel_id|default:''|escape)}

[`Save this URL to MAX for business › select your bot › Mini-app › URL.`]
[`The URL will never change unless the channel is deleted.`]

{/if}
[`Payment`]
{sprintf_wp( '%s mini-app checkout payment is based on Webasyst Pay.', '[`MAX`]', 'href="'|cat:$wa_app_url|cat:'?action=settings#/payment/" class="nowrap"' )}
{if !empty($channel.id)}
{/if}