├── .gitignore
├── README.md
├── composer.json
├── composer.lock
├── default_option.php
├── description.ru
├── include.php
├── install
├── components
│ └── mindbox
│ │ ├── auth.sms
│ │ ├── .description.php
│ │ ├── .parameters.php
│ │ ├── class.php
│ │ ├── lang
│ │ │ ├── en
│ │ │ │ ├── .description.php
│ │ │ │ ├── .parameters.php
│ │ │ │ └── class.php
│ │ │ └── ru
│ │ │ │ ├── .description.php
│ │ │ │ ├── .parameters.php
│ │ │ │ └── class.php
│ │ └── templates
│ │ │ └── .default
│ │ │ ├── lang
│ │ │ ├── en
│ │ │ │ └── template.php
│ │ │ └── ru
│ │ │ │ └── template.php
│ │ │ ├── script.js
│ │ │ └── template.php
│ │ ├── bonus.history
│ │ ├── .description.php
│ │ ├── .parameters.php
│ │ ├── class.php
│ │ ├── lang
│ │ │ ├── en
│ │ │ │ ├── .description.php
│ │ │ │ ├── .parameters.php
│ │ │ │ └── class.php
│ │ │ └── ru
│ │ │ │ ├── .description.php
│ │ │ │ ├── .parameters.php
│ │ │ │ └── class.php
│ │ └── templates
│ │ │ └── .default
│ │ │ ├── lang
│ │ │ ├── en
│ │ │ │ └── template.php
│ │ │ └── ru
│ │ │ │ └── template.php
│ │ │ ├── script.js
│ │ │ └── template.php
│ │ ├── cart
│ │ ├── .description.php
│ │ ├── .parameters.php
│ │ ├── class.php
│ │ ├── lang
│ │ │ ├── en
│ │ │ │ ├── .description.php
│ │ │ │ ├── .parameters.php
│ │ │ │ └── class.php
│ │ │ └── ru
│ │ │ │ ├── .description.php
│ │ │ │ ├── .parameters.php
│ │ │ │ └── class.php
│ │ └── templates
│ │ │ └── .default
│ │ │ ├── lang
│ │ │ ├── en
│ │ │ │ └── template.php
│ │ │ └── ru
│ │ │ │ └── template.php
│ │ │ ├── script.js
│ │ │ └── template.php
│ │ ├── catalog.tracking
│ │ ├── .description.php
│ │ ├── class.php
│ │ ├── lang
│ │ │ ├── en
│ │ │ │ ├── .description.php
│ │ │ │ └── class.php
│ │ │ └── ru
│ │ │ │ ├── .description.php
│ │ │ │ └── class.php
│ │ └── templates
│ │ │ └── .default
│ │ │ └── template.php
│ │ ├── discount.card
│ │ ├── .description.php
│ │ ├── .parameters.php
│ │ ├── class.php
│ │ ├── lang
│ │ │ ├── en
│ │ │ │ ├── .description.php
│ │ │ │ ├── .parameters.php
│ │ │ │ └── class.php
│ │ │ └── ru
│ │ │ │ ├── .description.php
│ │ │ │ ├── .parameters.php
│ │ │ │ └── class.php
│ │ └── templates
│ │ │ └── .default
│ │ │ ├── lang
│ │ │ ├── en
│ │ │ │ └── template.php
│ │ │ └── ru
│ │ │ │ └── template.php
│ │ │ ├── script.js
│ │ │ └── template.php
│ │ ├── email.confirm
│ │ ├── .description.php
│ │ ├── class.php
│ │ ├── lang
│ │ │ ├── en
│ │ │ │ ├── .description.php
│ │ │ │ └── class.php
│ │ │ └── ru
│ │ │ │ ├── .description.php
│ │ │ │ └── class.php
│ │ └── templates
│ │ │ └── .default
│ │ │ ├── lang
│ │ │ ├── en
│ │ │ │ └── template.php
│ │ │ └── ru
│ │ │ │ └── template.php
│ │ │ ├── script.js
│ │ │ └── template.php
│ │ ├── order.history
│ │ ├── .description.php
│ │ ├── .parameters.php
│ │ ├── class.php
│ │ ├── lang
│ │ │ ├── en
│ │ │ │ ├── .description.php
│ │ │ │ ├── .parameters.php
│ │ │ │ └── class.php
│ │ │ └── ru
│ │ │ │ ├── .description.php
│ │ │ │ ├── .parameters.php
│ │ │ │ └── class.php
│ │ └── templates
│ │ │ └── .default
│ │ │ ├── lang
│ │ │ ├── en
│ │ │ │ └── template.php
│ │ │ └── ru
│ │ │ │ └── template.php
│ │ │ ├── script.js
│ │ │ └── template.php
│ │ ├── phone.confirm
│ │ ├── .description.php
│ │ ├── class.php
│ │ ├── lang
│ │ │ ├── en
│ │ │ │ ├── .description.php
│ │ │ │ └── class.php
│ │ │ └── ru
│ │ │ │ ├── .description.php
│ │ │ │ └── class.php
│ │ └── templates
│ │ │ └── .default
│ │ │ ├── lang
│ │ │ ├── en
│ │ │ │ └── template.php
│ │ │ └── ru
│ │ │ │ └── template.php
│ │ │ ├── script.js
│ │ │ └── template.php
│ │ ├── product.bonus
│ │ ├── class.php
│ │ └── templates
│ │ │ └── .default
│ │ │ ├── script.js
│ │ │ ├── style.css
│ │ │ ├── template.php
│ │ │ └── view.php
│ │ ├── product.price
│ │ ├── class.php
│ │ └── templates
│ │ │ └── .default
│ │ │ ├── script.js
│ │ │ ├── style.css
│ │ │ └── template.php
│ │ ├── sub.edit
│ │ ├── .description.php
│ │ ├── class.php
│ │ ├── lang
│ │ │ ├── en
│ │ │ │ ├── .description.php
│ │ │ │ └── class.php
│ │ │ └── ru
│ │ │ │ ├── .description.php
│ │ │ │ └── class.php
│ │ └── templates
│ │ │ └── .default
│ │ │ ├── lang
│ │ │ ├── en
│ │ │ │ └── template.php
│ │ │ └── ru
│ │ │ │ └── template.php
│ │ │ ├── script.js
│ │ │ └── template.php
│ │ └── subscription
│ │ ├── .description.php
│ │ ├── class.php
│ │ ├── lang
│ │ ├── en
│ │ │ ├── .description.php
│ │ │ └── class.php
│ │ └── ru
│ │ │ ├── .description.php
│ │ │ └── class.php
│ │ └── templates
│ │ └── .default
│ │ ├── lang
│ │ ├── en
│ │ │ └── template.php
│ │ └── ru
│ │ │ └── template.php
│ │ ├── script.js
│ │ └── template.php
├── css
│ └── style.css
├── images
│ └── loader.gif
├── index.php
├── js
│ ├── jquery-3.3.1.min.js
│ ├── jquery.inputmask.bundle.js
│ ├── script.js
│ ├── tracker.js
│ └── tracker.js.orig
├── step1.php
├── unstep1.php
├── unstep2.php
└── version.php
├── lang
├── en
│ ├── install
│ │ ├── index.php
│ │ ├── step1.php
│ │ └── version.php
│ ├── lib
│ │ ├── AccessLogs.php
│ │ ├── Discount
│ │ │ └── MindboxDeliveryDiscountAction.php
│ │ ├── Event.php
│ │ ├── ExtensionCartRulesActions.php
│ │ ├── Helper.php
│ │ ├── Installer
│ │ │ └── OrderPropertiesInstaller.php
│ │ └── Templates
│ │ │ └── AdminLayouts.php
│ └── options.php
└── ru
│ ├── install
│ ├── index.php
│ ├── step1.php
│ └── version.php
│ ├── lib
│ ├── AccessLogs.php
│ ├── Discount
│ │ └── MindboxDeliveryDiscountAction.php
│ ├── Event.php
│ ├── EventController.php
│ ├── ExtensionCartRulesActions.php
│ ├── Helper.php
│ ├── Installer
│ │ └── OrderPropertiesInstaller.php
│ └── Templates
│ │ └── AdminLayouts.php
│ └── options.php
├── lib
├── AccessLogs.php
├── Ajax.php
├── Components
│ └── CalculateProductData.php
├── Core.php
├── DataBase
│ ├── MindboxTransactionTable.php
│ └── ModuleToModuleTable.php
├── Discount
│ ├── DeliveryDiscountEntity.php
│ ├── MindboxDeliveryDiscountAction.php
│ └── MindboxDiscountActions.php
├── Event.php
├── EventController.php
├── ExtensionCartRulesActions.php
├── Handlers
│ ├── Basket.php
│ ├── Order.php
│ └── User.php
├── Helper.php
├── Installer
│ ├── CartRuleInstaller.php
│ ├── DeliveryCartRuleInstaller.php
│ ├── OrderPropertiesInstaller.php
│ └── ProductCartRuleInstaller.php
├── LogsRotation.php
├── Options.php
├── QueueTable.php
├── Templates
│ └── AdminLayouts.php
├── Transaction.php
└── YmlFeedMindbox.php
├── logs
├── .htaccess
└── index.php
├── options.php
├── phpcs.xml
└── updater.php
/.gitignore:
--------------------------------------------------------------------------------
1 | /vendor/
2 | /lib/SDK/
3 | /tmp/
4 | .idea
--------------------------------------------------------------------------------
/composer.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "mindbox/marketing",
3 | "type": "bitrix-module",
4 | "license": "MIT",
5 | "minimum-stability": "stable",
6 | "require": {
7 | "mindbox/sdk": "1.0.7"
8 | },
9 | "autoload": {
10 | "psr-4": {
11 | "Mindbox\\": "lib/"
12 | }
13 | },
14 | "require-dev": {
15 | "squizlabs/php_codesniffer": "^3.6"
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/composer.lock:
--------------------------------------------------------------------------------
1 | {
2 | "_readme": [
3 | "This file locks the dependencies of your project to a known state",
4 | "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
5 | "This file is @generated automatically"
6 | ],
7 | "content-hash": "9a22928ca903820be13131eeba3b56ba",
8 | "packages": [
9 | {
10 | "name": "mindbox/sdk",
11 | "version": "1.0.7",
12 | "source": {
13 | "type": "git",
14 | "url": "https://github.com/mindbox-moscow/php-sdk.git",
15 | "reference": "465216bb10e16432b9b490b295b82bae3980aa89"
16 | },
17 | "dist": {
18 | "type": "zip",
19 | "url": "https://api.github.com/repos/mindbox-moscow/php-sdk/zipball/465216bb10e16432b9b490b295b82bae3980aa89",
20 | "reference": "465216bb10e16432b9b490b295b82bae3980aa89",
21 | "shasum": ""
22 | },
23 | "require": {
24 | "ext-json": "*",
25 | "ext-libxml": "*",
26 | "ext-simplexml": "*",
27 | "php": "^5.6|^7.0",
28 | "psr/log": "^1.1"
29 | },
30 | "require-dev": {
31 | "mikey179/vfsstream": "*",
32 | "phpunit/phpunit": "^5",
33 | "squizlabs/php_codesniffer": "^3.4"
34 | },
35 | "suggest": {
36 | "ext-curl": "*"
37 | },
38 | "type": "library",
39 | "autoload": {
40 | "psr-4": {
41 | "Mindbox\\": "src/"
42 | }
43 | },
44 | "notification-url": "https://packagist.org/downloads/",
45 | "description": "Mindbox SDK for PHP",
46 | "keywords": [
47 | "mindbox",
48 | "sdk"
49 | ],
50 | "time": "2022-04-12T09:18:30+00:00"
51 | },
52 | {
53 | "name": "psr/log",
54 | "version": "1.1.4",
55 | "source": {
56 | "type": "git",
57 | "url": "https://github.com/php-fig/log.git",
58 | "reference": "d49695b909c3b7628b6289db5479a1c204601f11"
59 | },
60 | "dist": {
61 | "type": "zip",
62 | "url": "https://api.github.com/repos/php-fig/log/zipball/d49695b909c3b7628b6289db5479a1c204601f11",
63 | "reference": "d49695b909c3b7628b6289db5479a1c204601f11",
64 | "shasum": ""
65 | },
66 | "require": {
67 | "php": ">=5.3.0"
68 | },
69 | "type": "library",
70 | "extra": {
71 | "branch-alias": {
72 | "dev-master": "1.1.x-dev"
73 | }
74 | },
75 | "autoload": {
76 | "psr-4": {
77 | "Psr\\Log\\": "Psr/Log/"
78 | }
79 | },
80 | "notification-url": "https://packagist.org/downloads/",
81 | "license": [
82 | "MIT"
83 | ],
84 | "authors": [
85 | {
86 | "name": "PHP-FIG",
87 | "homepage": "https://www.php-fig.org/"
88 | }
89 | ],
90 | "description": "Common interface for logging libraries",
91 | "homepage": "https://github.com/php-fig/log",
92 | "keywords": [
93 | "log",
94 | "psr",
95 | "psr-3"
96 | ],
97 | "time": "2021-05-03T11:20:27+00:00"
98 | }
99 | ],
100 | "packages-dev": [
101 | {
102 | "name": "squizlabs/php_codesniffer",
103 | "version": "3.6.2",
104 | "source": {
105 | "type": "git",
106 | "url": "https://github.com/squizlabs/PHP_CodeSniffer.git",
107 | "reference": "5e4e71592f69da17871dba6e80dd51bce74a351a"
108 | },
109 | "dist": {
110 | "type": "zip",
111 | "url": "https://api.github.com/repos/squizlabs/PHP_CodeSniffer/zipball/5e4e71592f69da17871dba6e80dd51bce74a351a",
112 | "reference": "5e4e71592f69da17871dba6e80dd51bce74a351a",
113 | "shasum": ""
114 | },
115 | "require": {
116 | "ext-simplexml": "*",
117 | "ext-tokenizer": "*",
118 | "ext-xmlwriter": "*",
119 | "php": ">=5.4.0"
120 | },
121 | "require-dev": {
122 | "phpunit/phpunit": "^4.0 || ^5.0 || ^6.0 || ^7.0"
123 | },
124 | "bin": [
125 | "bin/phpcs",
126 | "bin/phpcbf"
127 | ],
128 | "type": "library",
129 | "extra": {
130 | "branch-alias": {
131 | "dev-master": "3.x-dev"
132 | }
133 | },
134 | "notification-url": "https://packagist.org/downloads/",
135 | "license": [
136 | "BSD-3-Clause"
137 | ],
138 | "authors": [
139 | {
140 | "name": "Greg Sherwood",
141 | "role": "lead"
142 | }
143 | ],
144 | "description": "PHP_CodeSniffer tokenizes PHP, JavaScript and CSS files and detects violations of a defined set of coding standards.",
145 | "homepage": "https://github.com/squizlabs/PHP_CodeSniffer",
146 | "keywords": [
147 | "phpcs",
148 | "standards"
149 | ],
150 | "time": "2021-12-12T21:44:58+00:00"
151 | }
152 | ],
153 | "aliases": [],
154 | "minimum-stability": "stable",
155 | "stability-flags": [],
156 | "prefer-stable": false,
157 | "prefer-lowest": false,
158 | "platform": [],
159 | "platform-dev": [],
160 | "plugin-api-version": "1.1.0"
161 | }
162 |
--------------------------------------------------------------------------------
/default_option.php:
--------------------------------------------------------------------------------
1 | '',
5 | 'DOMAIN' => '',
6 | 'SECRET_KEY' => '',
7 | 'LOG_PATH' => $_SERVER['DOCUMENT_ROOT'] .'/logs/',
8 | 'HTTP_CLIENT' => '',
9 | 'TIMEOUT' => 5,
10 | 'QUEUE_TIMEOUT' => 30,
11 | 'WEBSITE_PREFIX' => '',
12 | 'TRANSACTION_ID' => '',
13 | 'CATALOG_IBLOCK_ID' => '',
14 | 'YML_NAME' => 'upload/mindbox.xml',
15 | 'EXTERNAL_SYSTEM' => '',
16 | 'WEBSITE_ID' => '',
17 | 'CATALOG_PROPS' => '',
18 | 'CATALOG_OFFER_PROPS' => '',
19 | 'TRACKER_JS_FILENAME' => '/bitrix/js/mindbox/tracker.js',
20 | 'TRACKER_JS_FILENAME_ORIGINAL' => '/bitrix/js/mindbox/tracker.js.orig'
21 | ];
22 |
--------------------------------------------------------------------------------
/description.ru:
--------------------------------------------------------------------------------
1 | Обновление 1.4.1
2 |
--------------------------------------------------------------------------------
/include.php:
--------------------------------------------------------------------------------
1 | GetMessage('NAME'),
6 | "DESCRIPTION" => "",
7 | "SORT" => 10,
8 | "CACHE_PATH" => "Y",
9 | "PATH" => array(
10 | "ID" => "mindbox",
11 | ),
12 | "COMPLEX" => "N",
13 | );
14 |
--------------------------------------------------------------------------------
/install/components/mindbox/auth.sms/.parameters.php:
--------------------------------------------------------------------------------
1 | [
8 | "PERSONAL_PAGE_URL" => [
9 | "PARENT" => "BASE",
10 | "NAME" => GetMessage('PERSONAL_PAGE_URL'),
11 | "TYPE" => "STRING",
12 | "DEFAULT" => SITE_DIR . '/'
13 | ],
14 | "FILLUP_FORM_FIELDS" => [
15 | "PARENT" => "BASE",
16 | "NAME" => GetMessage('FILLUP_FORM_FIELDS'),
17 | "TYPE" => "LIST",
18 | "MULTIPLE" => "Y",
19 | "VALUES" => [
20 | 'NAME' => GetMessage('NAME'),
21 | 'LAST_NAME' => GetMessage('LAST_NAME'),
22 | 'EMAIL' => GetMessage('EMAIL'),
23 | 'MOBILE_PHONE' => GetMessage('MOBILE_PHONE'),
24 | 'PASSWORD' => GetMessage('PASSWORD'),
25 | 'BIRTH_DATE' => GetMessage('BIRTH_DATE'),
26 | 'GENDER' => GetMessage('GENDER')
27 | ],
28 | "DEFAULT" => 'EMAIL'
29 | ]
30 | ]
31 | ];
32 |
33 |
--------------------------------------------------------------------------------
/install/components/mindbox/auth.sms/lang/en/.description.php:
--------------------------------------------------------------------------------
1 | GetMessage('NAME'),
6 | "DESCRIPTION" => "",
7 | "SORT" => 10,
8 | "CACHE_PATH" => "Y",
9 | "PATH" => array(
10 | "ID" => "mindbox",
11 | ),
12 | "COMPLEX" => "N",
13 | );
14 |
--------------------------------------------------------------------------------
/install/components/mindbox/bonus.history/.parameters.php:
--------------------------------------------------------------------------------
1 | [
6 | "PAGE_SIZE" => [
7 | "PARENT" => "BASE",
8 | "NAME" => GetMessage('PAGE_SIZE'),
9 | "TYPE" => "STRING",
10 | "DEFAULT" => 5
11 | ]
12 | ]
13 | ];
14 |
15 |
--------------------------------------------------------------------------------
/install/components/mindbox/bonus.history/class.php:
--------------------------------------------------------------------------------
1 | 'mindbox.marketing']));
36 | return;
37 | }
38 | } catch (LoaderException $e) {
39 | ShowError(GetMessage('MB_BH_MODULE_NOT_INCLUDED', ['#MODULE#' => 'mindbox.marketing']));
40 | return;
41 | }
42 |
43 | $this->mindbox = Options::getConfig();
44 | }
45 |
46 | public function configureActions()
47 | {
48 | return Ajax::configureActions($this->actions);
49 | }
50 |
51 | public function pageAction($page)
52 | {
53 | if (!$this->mindbox) {
54 | return Ajax::errorResponse('Incorrect module settings');
55 | }
56 | $page = intval($page);
57 | $this->arParams = Ajax::loadParams(self::getName());
58 | $size = isset($this->arParams['PAGE_SIZE']) ? $this->arParams['PAGE_SIZE'] : 0;
59 |
60 | try {
61 | $orders = $this->getHistory($page);
62 | $showMore = count($orders) === intval($size);
63 |
64 | return [
65 | 'type' => 'success',
66 | 'page' => $page,
67 | 'html' => $this->getHtml($orders),
68 | 'more' => $showMore
69 | ];
70 | } catch (Mindbox\Exceptions\MindboxException $e) {
71 | return Ajax::errorResponse('Can\'t load requested page');
72 | }
73 | }
74 |
75 |
76 | /**
77 | * @param $page
78 | * @return array
79 | * @throws MindboxException
80 | */
81 | public function getHistory($page)
82 | {
83 | global $USER;
84 | if (!$USER->IsAuthorized()) {
85 | throw new MindboxException(GetMessage('MB_BH_ERROR_MESSAGE'));
86 | }
87 |
88 | if (!$this->mindbox) {
89 | throw new MindboxException('Incorrect module settings');
90 | }
91 | $page = intval($page);
92 | $history = [];
93 | $mindboxId = $this->getMindboxId();
94 | if (!$mindboxId) {
95 | throw new MindboxException(GetMessage('MB_BH_ERROR_MESSAGE'));
96 | }
97 | $operation = Options::getOperationName('getBonusPointsHistory');
98 |
99 | $pageDTO = new PageRequestDTO();
100 | $pageDTO->setItemsPerPage($this->arParams['PAGE_SIZE']);
101 | $pageDTO->setPageNumber($page);
102 |
103 | $customer = new CustomerRequestDTO();
104 | $customer->setId('mindboxId', $mindboxId);
105 |
106 | try {
107 | $response = $this->mindbox->customer()->getBonusPointsHistory(
108 | $customer,
109 | $pageDTO,
110 | $operation
111 | )->sendRequest();
112 | } catch (Exception $e) {
113 | throw new MindboxException(GetMessage('MB_BH_ERROR_MESSAGE'));
114 | }
115 |
116 | $result = $response->getResult();
117 |
118 | if (!$result->getCustomerActions()) {
119 | throw new MindboxException(GetMessage('MB_BH_ERROR_MESSAGE'));
120 | }
121 |
122 |
123 | foreach ($result->getCustomerActions() as $action) {
124 | foreach ($action->getCustomerBalanceChanges() as $customerBalanceChanges) {
125 | $comment = $customerBalanceChanges->getField('comment');
126 |
127 | if (empty($comment)) {
128 | $type = $customerBalanceChanges->getField('balanceChangeKind')->getField('systemName');
129 | $isPositive = (int)$customerBalanceChanges->getField('changeAmount') > 0;
130 | $orderData = $action->getOrder();
131 |
132 | $comment = '';
133 | $orderId = false;
134 |
135 | if (!empty($orderData) && is_object($orderData)) {
136 | $orderId = array_pop($orderData->getField('ids'));
137 | }
138 |
139 | if ($type === 'RetailOrderBonus') {
140 | if ($isPositive) {
141 | $comment = GetMessage('MB_EARN_POINTS');
142 | } else {
143 | $comment = GetMessage('MB_RETURN_POINTS');
144 | }
145 | } elseif ($type === 'RetailOrderPayment') {
146 | if ($isPositive) {
147 | $comment = GetMessage('MB_SPEND_POINTS');
148 | } else {
149 | $comment = GetMessage('MB_REFUND_POINTS');
150 | }
151 | }
152 |
153 | if (!empty($comment)) {
154 | $comment .= $orderId;
155 | }
156 | }
157 |
158 | $history[] = [
159 | 'start' => $this->formatTime($action->getDateTimeUtc()),
160 | 'size' => $customerBalanceChanges->getChangeAmount(),
161 | 'name' => $comment,
162 | 'end' => $this->formatTime($customerBalanceChanges->getExpirationDateTimeUtc())
163 | ];
164 | }
165 | }
166 |
167 | if (!$this->getMindboxId()) {
168 | return $history;
169 | }
170 |
171 | $request = $this->mindbox->getClientV3()->prepareRequest(
172 | 'POST',
173 | Options::getOperationName('getCustomerInfo'),
174 | new DTO(['customer' => ['ids' => ['mindboxId' => $this->getMindboxId()]]])
175 | );
176 |
177 | try {
178 | $response = $request->sendRequest()->getResult();
179 | $arBalances = reset($response->getBalances()->getFieldsAsArray());
180 | $this->arResult['BALANCE'] = [
181 | 'available' => $arBalances['available'],
182 | 'blocked' => $arBalances['blocked']
183 | ];
184 | } catch (MindboxClientException $e) {
185 | throw new MindboxException($e->getMessage());
186 | }
187 |
188 | return $history;
189 | }
190 |
191 | public function formatTime($utc)
192 | {
193 | return (new DateTime($utc))->format('Y-m-d H:i:s');
194 | }
195 |
196 | public function executeComponent()
197 | {
198 | $_SESSION[self::getName()] = $this->arParams;
199 | $this->prepareResult();
200 | $this->includeComponentTemplate();
201 | }
202 |
203 | public function prepareResult()
204 | {
205 | $page = 1;
206 |
207 | try {
208 | $this->arResult['HISTORY'] = $this->getHistory($page);
209 | } catch (MindboxException $e) {
210 | $this->arResult['ERROR'] = $e->getMessage();
211 | }
212 | }
213 |
214 | protected function getHtml($history)
215 | {
216 | $html = '';
217 |
218 | foreach ($history as $change) {
219 | $html .= GetMessage(
220 | 'MB_BH_BALANCE_HTML',
221 | [
222 | '#START#' => $change['start'],
223 | '#SIZE#' => $change['size'],
224 | '#END#' => $change['end'],
225 | '#NAME#' => $change['name']
226 | ]
227 | );
228 | }
229 |
230 | return $html;
231 | }
232 |
233 | private function getMindboxId()
234 | {
235 | global $USER;
236 |
237 | return Helper::getMindboxId($USER->GetID());
238 | }
239 | }
240 |
--------------------------------------------------------------------------------
/install/components/mindbox/bonus.history/lang/en/.description.php:
--------------------------------------------------------------------------------
1 |
#START# | #SIZE# | #NAME# | #END# | ';
5 | $MESS['MB_BH_ERROR_MESSAGE'] = 'Bonus history is temporarily unavailable';
6 | $MESS['MB_EARN_POINTS'] = 'Earning points for an order ';
7 | $MESS['MB_RETURN_POINTS'] = 'Return points for an order ';
8 | $MESS['MB_SPEND_POINTS'] = 'Spend points for an order ';
9 | $MESS['MB_REFUND_POINTS'] = 'Refund of points for an order ';
10 |
--------------------------------------------------------------------------------
/install/components/mindbox/bonus.history/lang/ru/.description.php:
--------------------------------------------------------------------------------
1 | #START# | #SIZE# | #NAME# | #END# | ';
5 | $MESS['MB_BH_ERROR_MESSAGE'] = 'История бонусов временно недоступна';
6 | $MESS['MB_EARN_POINTS'] = 'Начисление баллов за заказ ';
7 | $MESS['MB_RETURN_POINTS'] = 'Списание начисленных баллов за заказ ';
8 | $MESS['MB_SPEND_POINTS'] = 'Оплата заказа ';
9 | $MESS['MB_REFUND_POINTS'] = 'Возврат баллов ';
10 |
--------------------------------------------------------------------------------
/install/components/mindbox/bonus.history/templates/.default/lang/en/template.php:
--------------------------------------------------------------------------------
1 | addJs("/bitrix/js/mindbox/jquery.inputmask.bundle.js");
10 | Asset::getInstance()->addJs("/bitrix/js/mindbox/script.js");
11 | Asset::getInstance()->addCss("/bitrix/css/mindbox/style.css");
12 | ?>
13 |
14 | IsAuthorized())
15 | {
16 | $APPLICATION->AuthForm("", false, false, 'N', false);
17 | } else {
18 | ?>
19 | ' . $arResult['ERROR'] . '';
21 | } else {
22 | ?>
23 |
24 | =GetMessage('MB_BH_AVAILABLE')?> =$arResult['BALANCE']['available'] ? : 0?> =GetMessage('MB_BH_BONUSES')?>.
25 |
26 |
27 |
28 | =GetMessage('MB_BH_BLOCKED')?> =$arResult['BALANCE']['blocked'] ? : 0?> =GetMessage('MB_BH_BONUSES')?>.
29 |
30 |
31 |
32 | =GetMessage('MB_BH_AVAILABLE')?> |
33 | =GetMessage('MB_BH_CHANGE')?> |
34 | =GetMessage('MB_BH_REASON')?> |
35 | =GetMessage('MB_BH_EXPIRE_DATE')?> |
36 |
37 |
38 |
39 | =$change['start']?> |
40 | =$change['size']?> |
41 | =$change['name']?> |
42 | =$change['end']?> |
43 |
44 |
45 |
46 |
47 |
48 |
=GetMessage('MB_BH_MORE')?>
49 |
50 |
51 | }
52 | }?>
--------------------------------------------------------------------------------
/install/components/mindbox/cart/.description.php:
--------------------------------------------------------------------------------
1 | GetMessage('NAME'),
6 | "DESCRIPTION" => "",
7 | "SORT" => 10,
8 | "CACHE_PATH" => "Y",
9 | "PATH" => array(
10 | "ID" => "mindbox",
11 | ),
12 | "COMPLEX" => "N",
13 | );
14 |
--------------------------------------------------------------------------------
/install/components/mindbox/cart/.parameters.php:
--------------------------------------------------------------------------------
1 | [
6 | "USE_BONUSES" => [
7 | "PARENT" => "BASE",
8 | "NAME" => GetMessage('USE_BONUSES'),
9 | "TYPE" => "CHECKBOX",
10 | "DEFAULT" => "Y"
11 | ]
12 | ]
13 | ];
14 |
15 |
--------------------------------------------------------------------------------
/install/components/mindbox/cart/lang/en/.description.php:
--------------------------------------------------------------------------------
1 | limit) {
66 | $('#mindbox-cart-success').hide();
67 |
68 | $('#mindbox-cart-error').text(limitMessage).show();
69 |
70 | return;
71 | }
72 |
73 | let $targetForLoadder = $('#mindbox-cart');
74 |
75 | loader.show($targetForLoadder);
76 |
77 | let request = BX.ajax.runComponentAction('mindbox:cart', 'applyBonuses', {
78 | mode: 'class',
79 | data: {
80 | bonuses: bonuses
81 | }
82 | });
83 |
84 | request.then(function (response) {
85 | loader.hide($targetForLoadder);
86 |
87 | if (response.data.type === 'success') {
88 | window.location.reload();
89 | }
90 | });
91 | });
92 |
93 | $('#mindbox-cart-clear-bonus').on('click', function () {
94 | $('#mindbox-pay-bonuses').trigger('click');
95 | });
96 |
97 | $('#mindbox-clear-code').on('click', function () {
98 | $('#mindbox-cart-error').hide();
99 | $('#mindbox-promocode-submit').trigger('click');
100 | })
101 | });
102 |
--------------------------------------------------------------------------------
/install/components/mindbox/cart/templates/.default/template.php:
--------------------------------------------------------------------------------
1 | addJs("/bitrix/js/mindbox/jquery.inputmask.bundle.js");
11 | Asset::getInstance()->addJs("/bitrix/js/mindbox/script.js");
12 | Asset::getInstance()->addCss("/bitrix/css/mindbox/style.css");
13 | ?>
14 |
15 |
--------------------------------------------------------------------------------
/install/components/mindbox/catalog.tracking/.description.php:
--------------------------------------------------------------------------------
1 | GetMessage('NAME'),
6 | "DESCRIPTION" => "",
7 | "SORT" => 10,
8 | "CACHE_PATH" => "Y",
9 | "PATH" => array(
10 | "ID" => "mindbox",
11 | ),
12 | "COMPLEX" => "N",
13 | );
14 |
--------------------------------------------------------------------------------
/install/components/mindbox/catalog.tracking/class.php:
--------------------------------------------------------------------------------
1 | loadModule()) {
17 | return;
18 | }
19 | }
20 |
21 | public function executeComponent()
22 | {
23 | $this->includeComponentTemplate();
24 | }
25 |
26 | private function loadModule()
27 | {
28 | try {
29 | return Loader::includeModule('mindbox.marketing');
30 | } catch (LoaderException $e) {
31 | return false;
32 | }
33 | }
34 | }
--------------------------------------------------------------------------------
/install/components/mindbox/catalog.tracking/lang/en/.description.php:
--------------------------------------------------------------------------------
1 |
6 |
7 |
38 |
--------------------------------------------------------------------------------
/install/components/mindbox/discount.card/.description.php:
--------------------------------------------------------------------------------
1 | GetMessage('NAME'),
6 | "DESCRIPTION" => "",
7 | "SORT" => 10,
8 | "CACHE_PATH" => "Y",
9 | "PATH" => array(
10 | "ID" => "mindbox",
11 | ),
12 | "COMPLEX" => "N",
13 | );
14 |
--------------------------------------------------------------------------------
/install/components/mindbox/discount.card/.parameters.php:
--------------------------------------------------------------------------------
1 | [
6 | "PERSONAL_PAGE_URL" => [
7 | "PARENT" => "BASE",
8 | "NAME" => GetMessage('PERSONAL_PAGE_URL'),
9 | "TYPE" => "STRING",
10 | "DEFAULT" => SITE_DIR . '/'
11 | ]
12 | ]
13 | ];
14 |
15 |
--------------------------------------------------------------------------------
/install/components/mindbox/discount.card/lang/en/.description.php:
--------------------------------------------------------------------------------
1 | addJs("/bitrix/js/mindbox/jquery.inputmask.bundle.js");
11 | Asset::getInstance()->addJs("/bitrix/js/mindbox/script.js");
12 | Asset::getInstance()->addCss("/bitrix/css/mindbox/style.css");
13 | ?>
14 |
15 | if (!$USER->IsAuthorized()) {
16 | $APPLICATION->AuthForm("", false, false, 'N', false);
17 | } else {
18 | ?>
19 |
80 | } ?>
--------------------------------------------------------------------------------
/install/components/mindbox/email.confirm/.description.php:
--------------------------------------------------------------------------------
1 | GetMessage('NAME'),
6 | "DESCRIPTION" => "",
7 | "SORT" => 10,
8 | "CACHE_PATH" => "Y",
9 | "PATH" => array(
10 | "ID" => "mindbox",
11 | ),
12 | "COMPLEX" => "N",
13 | );
14 |
--------------------------------------------------------------------------------
/install/components/mindbox/email.confirm/class.php:
--------------------------------------------------------------------------------
1 | 'mindbox.marketing']));
40 | return;
41 | }
42 | } catch (LoaderException $e) {
43 | ShowError(GetMessage('MB_EC_MODULE_NOT_INCLUDED', ['#MODULE#' => 'mindbox.marketing']));
44 | return;
45 | }
46 |
47 | $this->userInfo = $this->getUser();
48 | if (!$this->userInfo['UF_EMAIL_CONFIRMED'] && !empty($this->userInfo['EMAIL'])) {
49 | $this->mindbox = Options::getConfig();
50 | }
51 | }
52 |
53 | public function executeComponent()
54 | {
55 |
56 | if (!$this->userInfo['UF_EMAIL_CONFIRMED'] && !empty($this->userInfo['EMAIL'])) {
57 | $this->checkEmailConfirm();
58 | }
59 | $this->arResult['USER_INFO']['UF_EMAIL_CONFIRMED'] = $this->userInfo['UF_EMAIL_CONFIRMED'];
60 | $this->arResult['USER_INFO']['EMAIL'] = $this->userInfo['EMAIL'];
61 | $this->includeComponentTemplate();
62 | }
63 |
64 |
65 | public function configureActions()
66 | {
67 | return Ajax::configureActions($this->actions);
68 | }
69 |
70 | public function checkEmailConfirm()
71 | {
72 | global $USER;
73 |
74 | if(!$this->getMindboxId()) {
75 | return;
76 | }
77 |
78 | $request = $this->mindbox->getClientV3()->prepareRequest('POST',
79 | Options::getOperationName('getCustomerInfo'),
80 | new DTO(['customer' => ['ids' => ['mindboxId' => $this->getMindboxId()]]]));
81 |
82 | try {
83 | $response = $request->sendRequest();
84 | } catch (MindboxClientException $e) {
85 | return;
86 | }
87 | $customer = $response->getResult()->getCustomer();
88 | if ($customer && $customer->getProcessingStatus() === 'Found') {
89 | if (!empty($customer->getIsEmailConfirmed()) && empty($customer->getPendingEmail())) {
90 | $USER->Update($this->userInfo['ID'], ['UF_EMAIL_CONFIRMED' => '1']);
91 | }
92 | }
93 |
94 | }
95 |
96 | public function resendAction()
97 | {
98 | if (!$this->mindbox) {
99 | return Ajax::errorResponse(GetMessage('MB_EC_BAD_MODULE_SETTING'));
100 | }
101 | $customer = new CustomerRequestDTO(['ids' => ['mindboxId' => $this->getMindboxId()]]);
102 | try {
103 | $this->mindbox->customer()->resendConfirmationCode($customer,
104 | Options::getOperationName('resendEmailConfirm'))->sendRequest();
105 | } catch (MindboxClientException $e) {
106 | return Ajax::errorResponse($e);
107 | }
108 | }
109 |
110 | protected function getUser()
111 | {
112 | global $USER;
113 |
114 | $rsUser = UserTable::getList(
115 | [
116 | 'select' => ['EMAIL', 'UF_MINDBOX_ID', 'ID', 'UF_EMAIL_CONFIRMED'],
117 | 'filter' => ['ID' => $USER->GetID()]
118 | ]
119 | )->fetch();
120 |
121 | return $rsUser;
122 | }
123 |
124 | private function getMindboxId()
125 | {
126 | global $USER;
127 |
128 | return Helper::getMindboxId($USER->GetID());
129 | }
130 | }
--------------------------------------------------------------------------------
/install/components/mindbox/email.confirm/lang/en/.description.php:
--------------------------------------------------------------------------------
1 | #EMAIL# successfully verified';
4 | $MESS['MB_EC_RESEND_BUTTON'] = 'Resend';
5 | $MESS['MB_EC_RESEND_LABEL'] = 'Didn\'t receive a confirmation email?';
--------------------------------------------------------------------------------
/install/components/mindbox/email.confirm/templates/.default/lang/ru/template.php:
--------------------------------------------------------------------------------
1 | #EMAIL#, успешно подтвержден';
4 | $MESS['MB_EC_RESEND_BUTTON'] = 'Переотправить';
5 | $MESS['MB_EC_RESEND_LABEL'] = 'Не получили письмо с подтверждением?';
6 |
--------------------------------------------------------------------------------
/install/components/mindbox/email.confirm/templates/.default/script.js:
--------------------------------------------------------------------------------
1 | $(function () {
2 | $('#mindbox-email-confirm--resend').on('click', function () {
3 | let request = BX.ajax.runComponentAction('mindbox:email.confirm', 'resend', {
4 | mode:'class',
5 | });
6 |
7 | });
8 | });
9 |
--------------------------------------------------------------------------------
/install/components/mindbox/email.confirm/templates/.default/template.php:
--------------------------------------------------------------------------------
1 | addJs("/bitrix/js/mindbox/jquery.inputmask.bundle.js");
11 | Asset::getInstance()->addJs("/bitrix/js/mindbox/script.js");
12 | Asset::getInstance()->addCss("/bitrix/css/mindbox/style.css");
13 | ?>
14 |
15 | if ($USER->IsAuthorized()): ?>
16 |
17 | if (empty($arResult['USER_INFO']['EMAIL'])): ?>
18 |
19 | = GetMessage('MB_EC_INPUT_EMAIL') ?>
20 |
21 | elseif ($arResult['USER_INFO']['UF_EMAIL_CONFIRMED']): ?>
22 |
23 | = GetMessage('MB_EC_SUCCESS_CONFIRM', ['#EMAIL#' => $arResult['USER_INFO']['EMAIL']]) ?>
24 |
25 | else: ?>
26 |
30 |
34 |
45 | endif; ?>
46 |
47 | endif; ?>
48 |
--------------------------------------------------------------------------------
/install/components/mindbox/order.history/.description.php:
--------------------------------------------------------------------------------
1 | GetMessage('NAME'),
6 | "DESCRIPTION" => "",
7 | "SORT" => 10,
8 | "CACHE_PATH" => "Y",
9 | "PATH" => array(
10 | "ID" => "mindbox",
11 | ),
12 | "COMPLEX" => "N",
13 | );
14 |
--------------------------------------------------------------------------------
/install/components/mindbox/order.history/.parameters.php:
--------------------------------------------------------------------------------
1 | [
6 | "PAGE_SIZE" => [
7 | "PARENT" => "BASE",
8 | "NAME" => GetMessage('PAGE_SIZE'),
9 | "TYPE" => "STRING",
10 | "DEFAULT" => 5
11 | ]
12 | ]
13 | ];
14 |
15 |
--------------------------------------------------------------------------------
/install/components/mindbox/order.history/lang/en/.description.php:
--------------------------------------------------------------------------------
1 | Order № #ID# от #CREATED#.';
4 | $MESS['ORDER_SPENT'] = 'To pay for the order was used #SPENT# point#END#.';
5 | $MESS['ORDER_ACUIRED'] = 'For the order accrued #ACUIRED# point#END#.';
6 | $MESS['ENDINGS_ARRAY'] = ['s', 's', 's'];
7 | $MESS['ORDER_END_HEAD'] = '
';
8 | $MESS['ORDER_START_HEAD'] = '';
9 | $MESS['ORDER_START_TABLE'] = '
Product Name | Price |
';
10 | $MESS['ORDER_END_TABLE'] = '
';
11 | $MESS['ORDER_LINE'] = '#NAME# | #PRICE# |
';
12 | $MESS['ORDER_ERROR_MESSAGE'] = 'Bonus history is temporarily unavailable';
13 |
--------------------------------------------------------------------------------
/install/components/mindbox/order.history/lang/ru/.description.php:
--------------------------------------------------------------------------------
1 | Заказ № #ID# от #CREATED#.';
4 | $MESS['ORDER_SPENT'] = 'Для оплаты заказа было использовано #SPENT# балл#END#.';
5 | $MESS['ORDER_ACUIRED'] = 'За заказ начислено #ACUIRED# балл#END#.';
6 | $MESS['ENDINGS_ARRAY'] = ['', 'а', 'ов'];
7 | $MESS['ORDER_END_HEAD'] = '
';
8 | $MESS['ORDER_START_HEAD'] = '';
9 | $MESS['ORDER_START_TABLE'] = '
Название товара | Цена |
';
10 | $MESS['ORDER_END_TABLE'] = '
';
11 | $MESS['ORDER_LINE'] = '#NAME# | #PRICE# |
';
12 | $MESS['ORDER_ERROR_MESSAGE'] = 'История бонусов временно недоступна';
13 |
--------------------------------------------------------------------------------
/install/components/mindbox/order.history/templates/.default/lang/en/template.php:
--------------------------------------------------------------------------------
1 | Order № #ID# from #CREATED#.';
11 | $MESS['MB_OH_ORDER_SPENT'] = 'To pay for the order was used #SPENT# point#END#.';
12 | $MESS['MB_OH_ORDER_ACUIRED'] = 'For the order accrued #ACUIRED# point#END#.';
13 | $MESS['MB_OH_ENDINGS_ARRAY'] = ['', 'а', 'ов'];
14 | $MESS['MB_OH_ORDER_LINE'] = '
#NAME# | #PRICE# |
';
15 | $MESS['MB_OH_ITEM_NAME'] = 'Product Name';
16 | $MESS['MB_OH_ITEM_PRICE'] = 'Price';
17 | $MESS['MB_OH_MORE'] = 'Still';
18 |
--------------------------------------------------------------------------------
/install/components/mindbox/order.history/templates/.default/lang/ru/template.php:
--------------------------------------------------------------------------------
1 | Заказ № #ID# от #CREATED#.';
11 | $MESS['MB_OH_ORDER_SPENT'] = 'Для оплаты заказа было использовано #SPENT# балл#END#.';
12 | $MESS['MB_OH_ORDER_ACUIRED'] = 'За заказ начислено #ACUIRED# балл#END#.';
13 | $MESS['MB_OH_ENDINGS_ARRAY'] = ['', 'а', 'ов'];
14 | $MESS['MB_OH_ORDER_LINE'] = '
#NAME# | #PRICE# |
';
15 | $MESS['MB_OH_ITEM_NAME'] = 'Название товара';
16 | $MESS['MB_OH_ITEM_PRICE'] = 'Цена';
17 | $MESS['MB_OH_MORE'] = 'Ещё';
18 |
--------------------------------------------------------------------------------
/install/components/mindbox/order.history/templates/.default/script.js:
--------------------------------------------------------------------------------
1 | $(document).ready(function () {
2 | $('#mindbox-order-history--load-more').on('click', function () {
3 | let $moreButton = $('#mindbox-order-more');
4 | let $targetForLoader = $moreButton;
5 |
6 | loader.show($targetForLoader);
7 |
8 | let page = parseInt($moreButton.data('page')) + 1;
9 |
10 | let request = BX.ajax.runComponentAction('mindbox:order.history', 'page', {
11 | mode: 'class',
12 | data: {
13 | page: page,
14 | }
15 | });
16 |
17 | request.then(function (response) {
18 | loader.hide($targetForLoader);
19 |
20 | if (response.data.type === 'error') {
21 | $moreButton.hide();
22 | }
23 |
24 | if (response.data.type === 'success') {
25 | $moreButton.data('page', response.data.page);
26 |
27 | if (response.data.html === '') {
28 | $moreButton.hide();
29 | }
30 |
31 | if (response.data.more === false) {
32 | $moreButton.hide();
33 | }
34 |
35 | $('#mindbox-orders-history').append(response.data.html);
36 | }
37 | });
38 | });
39 | });
40 |
--------------------------------------------------------------------------------
/install/components/mindbox/order.history/templates/.default/template.php:
--------------------------------------------------------------------------------
1 | addJs("/bitrix/js/mindbox/jquery.inputmask.bundle.js");
14 | Asset::getInstance()->addJs("/bitrix/js/mindbox/script.js");
15 | Asset::getInstance()->addCss("/bitrix/css/mindbox/style.css");
16 | ?>
17 |
18 |
19 |
20 |
= $arResult['ERROR'] ?>
21 |
22 |
23 |
= GetMessage('MB_OH_EMPTY_MESSAGE') ?>
24 |
25 |
26 |
27 | = GetMessage('MB_OH_ORDER_HEADER', ['#ID#' => $order['id'], '#CREATED#' => $order['created']]) ?>
28 |
29 |
30 |
31 | = GetMessage('MB_OH_ORDER_SPENT', [
32 | '#SPENT#' => $order['spentBonuses'],
33 | '#END#' => Helper::getNumEnding(
34 | $order['spentBonuses'],
35 | GetMessage('MB_OH_ENDINGS_ARRAY')
36 | )
37 | ]); ?>
38 |
39 |
40 | = GetMessage('MB_OH_ORDER_ACUIRED', [
41 | '#ACUIRED#' => $order['acuiredBonuses'],
42 | '#END#' => Helper::getNumEnding(
43 | $order['acuiredBonuses'],
44 | GetMessage('MB_OH_ENDINGS_ARRAY')
45 | )
46 | ]); ?>
47 |
48 |
49 |
50 |
51 |
52 | = GetMessage('MB_OH_ITEM_NAME') ?> |
53 | = GetMessage('MB_OH_ITEM_PRICE') ?> |
54 |
55 |
56 | = GetMessage(
57 | 'MB_OH_ORDER_LINE',
58 | ['#LINK#' => $line['link'], '#NAME#' => $line['name'], '#PRICE#' => $line['price']]
59 | ); ?>
60 |
61 |
62 |
63 |
64 |
65 |
66 |
= GetMessage('MB_OH_MORE') ?>
67 |
68 |
69 |
70 |
71 |
--------------------------------------------------------------------------------
/install/components/mindbox/phone.confirm/.description.php:
--------------------------------------------------------------------------------
1 | GetMessage('NAME'),
6 | "DESCRIPTION" => "",
7 | "SORT" => 10,
8 | "CACHE_PATH" => "Y",
9 | "PATH" => array(
10 | "ID" => "mindbox",
11 | ),
12 | "COMPLEX" => "N",
13 | );
14 |
--------------------------------------------------------------------------------
/install/components/mindbox/phone.confirm/class.php:
--------------------------------------------------------------------------------
1 | 'mindbox.marketing']));
41 | return;
42 | }
43 | } catch (LoaderException $e) {
44 | ShowError(GetMessage('MB_PC_MODULE_NOT_INCLUDED', ['#MODULE#' => 'mindbox.marketing']));
45 | return;
46 | }
47 |
48 | $this->userInfo = $this->getUser();
49 | if (!$this->userInfo['UF_PHONE_CONFIRMED'] && !empty($this->userInfo['PERSONAL_PHONE'])) {
50 | $this->mindbox = Options::getConfig();
51 | }
52 | }
53 |
54 | public function executeComponent()
55 | {
56 | $this->arResult['USER_INFO']['UF_PHONE_CONFIRMED'] = $this->userInfo['UF_PHONE_CONFIRMED'];
57 | $this->arResult['USER_INFO']['PERSONAL_PHONE'] = $this->userInfo['PERSONAL_PHONE'];
58 | $this->includeComponentTemplate();
59 | }
60 |
61 |
62 | public function configureActions()
63 | {
64 | return Ajax::configureActions($this->actions);
65 | }
66 |
67 | public function checkCodeAction($code)
68 | {
69 | if (!$this->mindbox) {
70 | return Ajax::errorResponse(GetMessage('MB_PC_BAD_MODULE_SETTING'));
71 | }
72 |
73 | $code = htmlspecialcharsEx(trim($code));
74 | if (!$code) {
75 | return Ajax::errorResponse(GetMessage('MB_PC_EMPTY'));
76 | }
77 |
78 | global $USER;
79 | $customer = new CustomerRequestDTO(['ids' => ['mindboxId' => $this->getMindboxId()]]);
80 | $sms = new SmsConfirmationRequestDTO(['code' => $code]);
81 |
82 | try {
83 | $check = $this->mindbox->customer()
84 | ->confirmMobile($customer, $sms, Options::getOperationName('confirmMobile'))->sendRequest();
85 | } catch (MindboxClientException $e) {
86 | return Ajax::errorResponse(GetMessage('MB_PC_ERROR_CONFIRM'));
87 | }
88 |
89 | $confirmation = $check->getResult()->getSmsConfirmation();
90 | if(!$confirmation) {
91 | return Ajax::errorResponse(GetMessage('MB_PC_EMPTY'));
92 | }
93 | $status = $confirmation->getProcessingStatus();
94 |
95 | if ($status === 'MobilePhoneConfirmed') {
96 | $USER->Update($this->userInfo['ID'], ['UF_PHONE_CONFIRMED' => '1']);
97 | return [
98 | 'type' => 'success',
99 | 'message' => GetMessage('MB_PC_SUCCESS_CONFIRM')
100 | ];
101 | }
102 |
103 | return [
104 | 'type' => 'error',
105 | 'message' => GetMessage('MB_PC_INCORRECT_CODE')
106 | ];
107 | }
108 |
109 | public function resendCodeAction()
110 | {
111 | if (!$this->mindbox) {
112 | return Ajax::errorResponse(GetMessage('MB_PC_BAD_MODULE_SETTING'));
113 | }
114 | $customer = new CustomerRequestDTO(['ids' => ['mindboxId' => $this->getMindboxId()]]);
115 | try {
116 | $this->mindbox->customer()->resendConfirmationCode($customer,
117 | Options::getOperationName('resendConfirmationCode'))->sendRequest();
118 | } catch (MindboxClientException $e) {
119 | return Ajax::errorResponse($e);
120 | }
121 | }
122 |
123 | protected function getUser()
124 | {
125 | global $USER;
126 |
127 | $rsUser = UserTable::getList(
128 | [
129 | 'select' => ['PERSONAL_PHONE', 'UF_MINDBOX_ID', 'UF_PHONE_CONFIRMED', 'ID'],
130 | 'filter' => ['ID' => $USER->GetID()]
131 | ]
132 | )->fetch();
133 |
134 |
135 | if(!$this->getMindboxId()) {
136 | return $rsUser;
137 | }
138 |
139 |
140 | $mindbox = Options::getConfig();
141 | $request = $mindbox->getClientV3()->prepareRequest('POST',
142 | Options::getOperationName('getCustomerInfo'),
143 | new DTO([
144 | 'customer' => [
145 | 'ids' => [
146 | 'mindboxId' => $this->getMindboxId()
147 | ]
148 | ]
149 | ]));
150 |
151 | try {
152 | $response = $request->sendRequest()->getResult();
153 | } catch (MindboxClientException $e) {
154 | return $rsUser;
155 | }
156 |
157 | $customer = $response->getCustomer();
158 | if ($customer && $customer->getProcessingStatus() === 'Found') {
159 | $pending = $customer->getPendingMobilePhone();
160 | if ($pending) {
161 | $rsUser[ 'UF_PHONE_CONFIRMED' ] = false;
162 | } else {
163 | $rsUser[ 'UF_PHONE_CONFIRMED' ] = $customer->getIsMobilePhoneConfirmed();
164 | }
165 | }
166 |
167 |
168 | return $rsUser;
169 | }
170 |
171 | private function getMindboxId()
172 | {
173 | global $USER;
174 |
175 | return Helper::getMindboxId($USER->GetID());
176 | }
177 | }
--------------------------------------------------------------------------------
/install/components/mindbox/phone.confirm/lang/en/.description.php:
--------------------------------------------------------------------------------
1 | #PHONE# successfully verified';
4 | $MESS['MB_PC_CONFIRM_CODE'] = 'Confirmation code';
5 | $MESS['MB_PC_RESEND_BUTTON'] = 'Resend';
6 | $MESS['MB_PC_CHECK_CODE'] = 'Check code';
--------------------------------------------------------------------------------
/install/components/mindbox/phone.confirm/templates/.default/lang/ru/template.php:
--------------------------------------------------------------------------------
1 | #PHONE#, успешно подтвержден';
4 | $MESS['MB_PC_CONFIRM_CODE'] = 'Код подтверждения';
5 | $MESS['MB_PC_RESEND_BUTTON'] = 'Переотправить';
6 | $MESS['MB_PC_CHECK_CODE'] = 'Проверить код';
7 |
--------------------------------------------------------------------------------
/install/components/mindbox/phone.confirm/templates/.default/script.js:
--------------------------------------------------------------------------------
1 | $(function () {
2 | $('#mindbox-phone-confirm--resend').on('click', function () {
3 | let request = BX.ajax.runComponentAction('mindbox:phone.confirm', 'resendCode', {
4 | mode: 'class',
5 | });
6 | });
7 |
8 | $('#mindbox-phone-confirm #submit-button').on('click', function (e) {
9 | e.preventDefault();
10 |
11 | loader.show($('#mindbox-phone-confirm'));
12 |
13 | let code = $('#mindbox-code').val();
14 |
15 | let request = BX.ajax.runComponentAction('mindbox:phone.confirm', 'checkCode', {
16 | mode: 'class',
17 | data: {
18 | code: code
19 | }
20 | });
21 |
22 | request.then(function (response) {
23 | loader.hide($('#mindbox-phone-confirm'));
24 |
25 | if (response.data.type === 'error') {
26 | $('#mindbox-phone-confirm-error').text(response.data.message).show();
27 | } else if (response.data.type === 'success') {
28 | $('#mindbox-phone-confirm-error').hide();
29 | $('#mindbox-phone-confirm-success').text(response.data.message).show();
30 | }
31 | })
32 | })
33 | });
--------------------------------------------------------------------------------
/install/components/mindbox/phone.confirm/templates/.default/template.php:
--------------------------------------------------------------------------------
1 | addJs("/bitrix/js/mindbox/jquery.inputmask.bundle.js");
13 | Asset::getInstance()->addJs("/bitrix/js/mindbox/script.js");
14 | Asset::getInstance()->addCss("/bitrix/css/mindbox/style.css");
15 | ?>
16 |
17 | IsAuthorized()) : ?>
18 |
19 |
20 |
21 | = GetMessage('MB_PC_INPUT_PHONE')?>
22 |
23 |
24 |
25 | = GetMessage('MB_PC_SUCCESS_CONFIRM', ['#PHONE#' => $arResult['USER_INFO']['PERSONAL_PHONE']])?>
26 |
27 |
28 |
31 |
34 |
60 |
61 |
62 |
--------------------------------------------------------------------------------
/install/components/mindbox/product.bonus/class.php:
--------------------------------------------------------------------------------
1 | 'mindbox.marketing']));
28 | return;
29 | }
30 | } catch (LoaderException $e) {
31 | ShowError(GetMessage('MB_AUS_MODULE_NOT_INCLUDED', ['#MODULE#' => 'mindbox.marketing']));
32 | ;
33 | return;
34 | }
35 | }
36 |
37 | public function configureActions()
38 | {
39 | return Ajax::configureActions($this->actions);
40 | }
41 |
42 | public function onPrepareComponentParams($arParams)
43 | {
44 | return $arParams;
45 | }
46 |
47 | public function changeProductAction($productId, $price)
48 | {
49 | $productCache = \Mindbox\Components\CalculateProductData::getProductCache($productId);
50 |
51 | if (!empty($productCache)) {
52 | $return = [
53 | 'MINDBOX_BONUS' => $productCache['MINDBOX_BONUS'],
54 | ];
55 | } else {
56 | $objCalculateProductData = new \Mindbox\Components\CalculateProductData();
57 | $calcData = $objCalculateProductData->getCalculateProductsData([
58 | $productId => ['price' => $price, 'id' => $productId]
59 | ]);
60 |
61 | $return = current($calcData);
62 | }
63 |
64 | return [
65 | 'type' => 'success',
66 | 'return' => $return,
67 | ];
68 | }
69 |
70 | protected function createPlaceholder()
71 | {
72 | $prefix = self::PLACEHOLDER_PREFIX;
73 | return "{{{$prefix}|{$this->arParams['ID']}|{$this->arParams['PRICE']}|{$this->getLabelHtml()}|{$this->getValueHtml()}}}";
74 | }
75 |
76 | protected function getLabelHtml()
77 | {
78 | return self::LABEL_POSITION . '::' . $this->arParams['LABEL'] . '';
79 | }
80 |
81 | protected function getValueHtml()
82 | {
83 | return ':value:';
84 | }
85 |
86 | public function executeComponent()
87 | {
88 | $productCache = \Mindbox\Components\CalculateProductData::getHtmlProductCache($this->arParams['ID'], 'MINDBOX_BONUS');
89 |
90 | if (!empty($productCache)) {
91 | $this->arResult['MINDBOX_BONUS'] = $productCache['MINDBOX_BONUS'];
92 | } else {
93 | $this->arResult['MINDBOX_BONUS'] = $this->createPlaceholder();
94 | }
95 |
96 | $this->includeComponentTemplate();
97 | }
98 | }
99 |
--------------------------------------------------------------------------------
/install/components/mindbox/product.bonus/templates/.default/script.js:
--------------------------------------------------------------------------------
1 | if (typeof window.loadMindboxProductBonusComponent === 'undefined') {
2 | window.loadMindboxProductBonusComponent = true;
3 |
4 | document.addEventListener('DOMContentLoaded', function(){
5 | let productPriceItems = document.querySelectorAll('.mindbox-product-bonus');
6 |
7 | productPriceItems.forEach(function (item) {
8 | item.addEventListener("changeProductBonus", function(event) {
9 | let target = event.target;
10 | let productParams = event.detail;
11 | let request = BX.ajax.runComponentAction('mindbox:product.bonus', 'changeProduct', {
12 | mode:'class',
13 | data: {
14 | productId: productParams.productId,
15 | price: productParams.price,
16 | }
17 | });
18 |
19 | request.then(function (response) {
20 |
21 | if (response.data.type === 'success') {
22 | if (response.data.return.hasOwnProperty('MINDBOX_BONUS')) {
23 | target.querySelector('.mindbox-product-bonus__value').innerText = response.data.return['MINDBOX_BONUS'];
24 | }
25 | }
26 | });
27 | });
28 | });
29 | });
30 | }
31 |
--------------------------------------------------------------------------------
/install/components/mindbox/product.bonus/templates/.default/style.css:
--------------------------------------------------------------------------------
1 | .mindbox-product-bonus {
2 | font-size: 13px;
3 | text-align: center;
4 | }
5 |
6 | .mindbox-product-bonus__value {
7 | font-weight: bold;
8 | color: #62be1f;
9 | }
10 |
11 | .mindbox-product-bonus__label {
12 | color: #000;
13 | font-size: 13px;
14 | text-align: center;
15 | font-weight: normal;
16 | }
--------------------------------------------------------------------------------
/install/components/mindbox/product.bonus/templates/.default/template.php:
--------------------------------------------------------------------------------
1 |
8 |
9 | =$arResult['MINDBOX_BONUS']?>
10 |
11 |
12 |
13 |
14 |
--------------------------------------------------------------------------------
/install/components/mindbox/product.bonus/templates/.default/view.php:
--------------------------------------------------------------------------------
1 | ShowViewContent($arResult['INTEGRATION_KEY']);
8 | }
9 |
--------------------------------------------------------------------------------
/install/components/mindbox/product.price/class.php:
--------------------------------------------------------------------------------
1 | 'mindbox.marketing']));
31 | return;
32 | }
33 | } catch (LoaderException $e) {
34 | ShowError(GetMessage('MB_AUS_MODULE_NOT_INCLUDED', ['#MODULE#' => 'mindbox.marketing']));
35 | ;
36 | return;
37 | }
38 | }
39 |
40 | public function configureActions()
41 | {
42 | return Ajax::configureActions($this->actions);
43 | }
44 |
45 | public function onPrepareComponentParams($arParams)
46 | {
47 | return $arParams;
48 | }
49 |
50 | public function changeProductAction($productId, $price)
51 | {
52 | $productCache = \Mindbox\Components\CalculateProductData::getProductCache($productId);
53 | $useCache = false;
54 |
55 | if (!empty($productCache)) {
56 | $useCache = true;
57 |
58 | $return = [
59 | 'MINDBOX_PRICE' => $productCache['MINDBOX_PRICE'],
60 | 'MINDBOX_OLD_PRICE' => $productCache['MINDBOX_OLD_PRICE']
61 | ];
62 | } else {
63 | $objCalculateProductData = new \Mindbox\Components\CalculateProductData();
64 | $calcData = $objCalculateProductData->getCalculateProductsData([
65 | $productId => ['price' => $price, 'id' => $productId]
66 | ]);
67 |
68 | $return = current($calcData);
69 | }
70 |
71 | return [
72 | 'type' => 'success',
73 | 'return' => $return,
74 | 'cache' => $useCache
75 | ];
76 | }
77 |
78 | protected function createPlaceholder($prefix): string
79 | {
80 | return "{{{$prefix}|{$this->arParams['ID']}|{$this->arParams['PRICE']}}}";
81 | }
82 |
83 | protected function createPricePlaceholder(): string
84 | {
85 | $prefix = self::PLACEHOLDER_PRICE_PREFIX;
86 | return "{{{$prefix}|{$this->arParams['ID']}|{$this->arParams['PRICE']}|{$this->getLabelHtml()}|{$this->getPriceValueHtml()}}}";
87 | }
88 |
89 | protected function createOldPricePlaceholder(): string
90 | {
91 | $prefix = self::PLACEHOLDER_OLD_PRICE_PREFIX;
92 | return "{{{$prefix}|{$this->arParams['ID']}|{$this->arParams['PRICE']}|after::|{$this->getOldPriceValueHtml()}}}";
93 | }
94 |
95 | protected function getLabelHtml()
96 | {
97 | return self::LABEL_POSITION . '::' . $this->arParams['CURRENCY'] . '';
98 | }
99 |
100 | protected function getPriceValueHtml(): string
101 | {
102 | return ':value:';
103 | }
104 |
105 | protected function getOldPriceValueHtml(): string
106 | {
107 | return ':value:';
108 | }
109 |
110 |
111 | public function executeComponent()
112 | {
113 | $productCache = CalculateProductData::getHtmlProductCache($this->arParams['ID'], 'MINDBOX_PRICE');
114 | $this->arResult['PRODUCT_ID'] = $this->arParams['ID'];
115 |
116 | if (!empty($productCache)) {
117 | $this->arResult['MINDBOX_PRICE'] = $productCache;
118 | $this->arResult['MINDBOX_OLD_PRICE'] = CalculateProductData::getHtmlProductCache($this->arParams['ID'], 'MINDBOX_OLD_PRICE');
119 | } else {
120 | $this->arResult['MINDBOX_PRICE'] = $this->createPricePlaceholder();
121 | $this->arResult['MINDBOX_OLD_PRICE'] = $this->createOldPricePlaceholder();
122 | }
123 |
124 | $this->includeComponentTemplate();
125 | }
126 | }
127 |
--------------------------------------------------------------------------------
/install/components/mindbox/product.price/templates/.default/script.js:
--------------------------------------------------------------------------------
1 | if (typeof window.loadMindboxProductPriceComponent === 'undefined') {
2 | window.loadMindboxProductPriceComponent = true;
3 |
4 | document.addEventListener('DOMContentLoaded', function(){
5 | let productPriceItems = document.querySelectorAll('.mindbox-product-price');
6 |
7 | productPriceItems.forEach(function (item) {
8 | item.addEventListener("changeProductPrice", function(event) {
9 | let target = event.target;
10 | let productParams = event.detail;
11 | let request = BX.ajax.runComponentAction('mindbox:product.price', 'changeProduct', {
12 | mode:'class',
13 | data: {
14 | productId: productParams.productId,
15 | price: productParams.price,
16 |
17 | }
18 | });
19 |
20 | request.then(function (response) {
21 |
22 | if (response.data.type === 'success') {
23 | if (response.data.return.hasOwnProperty('MINDBOX_PRICE')) {
24 | target.querySelector('.mindbox-product-price__price').innerText = response.data.return['MINDBOX_PRICE'];
25 | }
26 |
27 | if (!response.data.return.hasOwnProperty('MINDBOX_OLD_PRICE')) {
28 | target.querySelector('.mindbox-product-price__discount').innerText = '';
29 | } else {
30 | target.querySelector('.mindbox-product-price__discount').innerText = response.data.return['MINDBOX_OLD_PRICE'];
31 | }
32 | }
33 | });
34 | });
35 | });
36 | });
37 | }
38 |
--------------------------------------------------------------------------------
/install/components/mindbox/product.price/templates/.default/style.css:
--------------------------------------------------------------------------------
1 | .mindbox-product-price {
2 | font-size: 18px;
3 | font-weight: bold;
4 | line-height: 15px;
5 | color: #1d2029;
6 | }
7 |
8 | .mindbox-product-price__discount {
9 | text-decoration: line-through;
10 | font-size: 14px;
11 | font-weight: normal;
12 | }
--------------------------------------------------------------------------------
/install/components/mindbox/product.price/templates/.default/template.php:
--------------------------------------------------------------------------------
1 |
8 |
9 | =$arResult['MINDBOX_OLD_PRICE']?>
10 |
11 | =$arResult['MINDBOX_PRICE']?>
12 |
13 |
--------------------------------------------------------------------------------
/install/components/mindbox/sub.edit/.description.php:
--------------------------------------------------------------------------------
1 | GetMessage('NAME'),
6 | "DESCRIPTION" => "",
7 | "SORT" => 10,
8 | "CACHE_PATH" => "Y",
9 | "PATH" => array(
10 | "ID" => "mindbox",
11 | ),
12 | "COMPLEX" => "N",
13 | );
14 |
--------------------------------------------------------------------------------
/install/components/mindbox/sub.edit/class.php:
--------------------------------------------------------------------------------
1 | 'mindbox.marketing']));
41 | return;
42 | }
43 | } catch (LoaderException $e) {
44 | ShowError(GetMessage('MB_SE_MODULE_NOT_INCLUDED', ['#MODULE#' => 'mindbox.marketing']));
45 | return;
46 | }
47 |
48 | $this->userInfo = $this->getUser();
49 | $this->mindbox = Options::getConfig();
50 | }
51 |
52 | public function configureActions()
53 | {
54 | return Ajax::configureActions($this->actions);
55 | }
56 |
57 | public function saveAction($fields)
58 | {
59 | if (!$this->mindbox) {
60 | return Ajax::errorResponse(GetMessage('MB_SE_BAD_MODULE_SETTING'));
61 | }
62 | $customer = new CustomerRequestDTO([
63 | 'ids' => ['mindboxId' => $this->getMindboxId()],
64 | ]);
65 |
66 | $subscriptions = [
67 | new SubscriptionRequestDTO([
68 | 'pointOfContact' => 'Email',
69 | 'isSubscribed' => $fields['SUBSCRIPTIONS']['Email']
70 | ]),
71 |
72 | new SubscriptionRequestDTO([
73 | 'pointOfContact' => 'Sms',
74 | 'isSubscribed' => $fields['SUBSCRIPTIONS']['Sms']
75 | ]),
76 | ];
77 |
78 | $customer->setSubscriptions($subscriptions);
79 |
80 | try {
81 | $this->mindbox->customer()->edit($customer, Options::getOperationName('edit'), true, true)->sendRequest();
82 | } catch (MindboxUnavailableException $e) {
83 | $lastResponse = $this->mindbox->customer()->getLastResponse();
84 |
85 | if ($lastResponse) {
86 | $request = $lastResponse->getRequest();
87 | QueueTable::push($request);
88 | }
89 | } catch (MindboxClientException $e) {
90 | return Ajax::errorResponse(GetMessage('MB_SE_ERROR_SUB'));
91 | }
92 |
93 | return [
94 | 'type' => 'success',
95 | 'message' => GetMessage('MB_SE_SUCCESS_SUB')
96 | ];
97 | }
98 |
99 | protected function getSubscriptions()
100 | {
101 | $subscriptions = ['Email' => false, 'Sms' => false];
102 |
103 | $request = $this->mindbox->getClientV3()->prepareRequest(
104 | 'POST',
105 | Options::getOperationName('getSubscriptions'),
106 | new DTO(['customer' => ['email' => $this->userInfo['EMAIL']]])
107 | );
108 |
109 | try {
110 | $response = $request->sendRequest()->getResult();
111 | if ($response->getCustomer()) {
112 | foreach ($response->getCustomer()->getSubscriptions() as $subscription) {
113 | $pointOfContact = $subscription->getPointOfContact();
114 | $isSubscribed = $subscription->getIsSubscribed();
115 | if ($isSubscribed) {
116 | $subscriptions[$pointOfContact] = true;
117 | }
118 | }
119 | }
120 | } catch (MindboxClientException $e) {
121 | }
122 |
123 | $this->arResult['SUBSCRIPTIONS'] = $subscriptions;
124 | }
125 |
126 | protected function getUser()
127 | {
128 | global $USER;
129 |
130 | $rsUser = UserTable::getList(
131 | [
132 | 'select' => ['UF_MINDBOX_ID', 'EMAIL', 'ID'],
133 | 'filter' => ['ID' => $USER->GetID()]
134 | ]
135 | )->fetch();
136 |
137 | return $rsUser;
138 | }
139 |
140 | public function executeComponent()
141 | {
142 | $this->getSubscriptions();
143 | $this->includeComponentTemplate();
144 | }
145 |
146 | private function getMindboxId()
147 | {
148 | global $USER;
149 |
150 | return Helper::getMindboxId($USER->GetID());
151 | }
152 | }
153 |
--------------------------------------------------------------------------------
/install/components/mindbox/sub.edit/lang/en/.description.php:
--------------------------------------------------------------------------------
1 | addJs("/bitrix/js/mindbox/jquery.inputmask.bundle.js");
10 | Asset::getInstance()->addJs("/bitrix/js/mindbox/script.js");
11 | Asset::getInstance()->addCss("/bitrix/css/mindbox/style.css");
12 | ?>
13 |
14 | if ($USER->IsAuthorized()): ?>
15 |
50 | endif; ?>
--------------------------------------------------------------------------------
/install/components/mindbox/subscription/.description.php:
--------------------------------------------------------------------------------
1 | GetMessage('NAME'),
6 | "DESCRIPTION" => "",
7 | "SORT" => 10,
8 | "CACHE_PATH" => "Y",
9 | "PATH" => array(
10 | "ID" => "mindbox",
11 | ),
12 | "COMPLEX" => "N",
13 | );
14 |
--------------------------------------------------------------------------------
/install/components/mindbox/subscription/class.php:
--------------------------------------------------------------------------------
1 | 'mindbox.marketing']));;
42 | return;
43 | }
44 | } catch (LoaderException $e) {
45 | ShowError(GetMessage('MB_SU_MODULE_NOT_INCLUDED', ['#MODULE#' => 'mindbox.marketing']));;
46 | return;
47 | }
48 |
49 | $this->mindbox = Options::getConfig();
50 | }
51 |
52 | public function configureActions()
53 | {
54 | return Ajax::configureActions($this->actions);
55 | }
56 |
57 | public function subscribeAction($email)
58 | {
59 | if (!$this->mindbox) {
60 | return Ajax::errorResponse(GetMessage('MB_SU_BAD_MODULE_SETTING'));
61 | }
62 | $email = htmlspecialcharsEx(trim($email));
63 | if (empty($email)) {
64 | return Ajax::errorResponse('Incorrect email');
65 | }
66 |
67 | $customer = new CustomerRequestDTO(['email' => $email]);
68 | $subscripton = new SubscriptionRequestDTO(['pointOfContact' => 'Email']);
69 | $customer->setSubscriptions([$subscripton]);
70 | try {
71 | $this->mindbox->customer()->subscribe($customer,
72 | Options::getOperationName('subscribe'), true)->sendRequest();
73 |
74 | return [
75 | 'type' => 'success',
76 | 'message' => GetMessage('MB_SU_SUCCESS')
77 | ];
78 | } catch (MindboxClientException $e) {
79 | $request = $this->mindbox->customer()->getRequest();
80 | if ($request) {
81 | QueueTable::push($request);
82 | }
83 | return [
84 | 'type' => 'queue',
85 | 'message' => GetMessage('MB_SU_QUEUE')
86 | ];
87 | }
88 |
89 | }
90 |
91 | public function executeComponent()
92 | {
93 | $this->includeComponentTemplate();
94 | }
95 | }
--------------------------------------------------------------------------------
/install/components/mindbox/subscription/lang/en/.description.php:
--------------------------------------------------------------------------------
1 | addJs("/bitrix/js/mindbox/jquery.inputmask.bundle.js");
11 | Asset::getInstance()->addJs("/bitrix/js/mindbox/script.js");
12 | Asset::getInstance()->addCss("/bitrix/css/mindbox/style.css");
13 | ?>
14 |
15 |
31 |
--------------------------------------------------------------------------------
/install/images/loader.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mindbox-cloud/bitrix/c399ebc64aafab633dc04ded16154db67849e233/install/images/loader.gif
--------------------------------------------------------------------------------
/install/js/script.js:
--------------------------------------------------------------------------------
1 | $(document).ready(function () {
2 | var mindboxSettingDefault = {
3 | jsMask: function () {
4 | $('.js-mask').each(function () {
5 | let $input = $(this),
6 | inputType = $input.data('type'),
7 | maskOptions = {};
8 |
9 | switch (inputType) {
10 | case 'phone': {
11 | maskOptions.mask = '+7 (999) 999-99-99';
12 |
13 | break;
14 | }
15 | case 'email': {
16 | maskOptions.alias = 'email';
17 | maskOptions.showMaskOnHover = false;
18 | maskOptions.placeholder = '';
19 | maskOptions.jitMasking = true;
20 |
21 | break;
22 | }
23 | case 'decimal': {
24 | maskOptions.alias = 'decimal';
25 | maskOptions.groupSeparator = '';
26 | maskOptions.autoGroup = true;
27 | maskOptions.rightAlign = false;
28 |
29 | break;
30 | }
31 | case 'date': {
32 | maskOptions.alias = 'datetime';
33 | maskOptions.inputFormat = 'dd.mm.yyyy';
34 | }
35 | }
36 |
37 | $input.inputmask(maskOptions);
38 | });
39 | },
40 |
41 | jsTimer: function () {
42 | let _this = this;
43 |
44 | $('.js-auth-code').each(function () {
45 | let authButton = {};
46 |
47 | authButton.$elem = $(this),
48 | authButton.$elemText = authButton.$elem.find('.js-auth-code-text'),
49 | authButton.$elemTimer = authButton.$elem.find('.js-auth-code-timer');
50 |
51 | authButton.$elem.on('click', function () {
52 | let lastTime = new Date().getTime();
53 |
54 | _this._timer(lastTime, authButton);
55 | });
56 | });
57 | },
58 |
59 | _timer: function (lastTime, authButton) {
60 | if (!lastTime) return;
61 |
62 | let intervalID;
63 |
64 | startTimer(lastTime);
65 |
66 | function startTimer(lastTime) {
67 | authButton.$elem.attr('disabled', true);
68 | authButton.$elemTimer.html('(30)');
69 |
70 | intervalID = setInterval(function () {
71 | timer(lastTime);
72 | }, 1000);
73 | }
74 |
75 | function timer(endTime) {
76 | let nowTime = new Date().getTime(),
77 | secondsLeft = Math.floor((nowTime - lastTime) / 1000),
78 | secondsRemaining = 30 - secondsLeft;
79 |
80 | if (secondsRemaining) {
81 | authButton.$elemTimer.html('(' + secondsRemaining + ')');
82 | } else {
83 | clearInterval(intervalID);
84 | authButton.$elemTimer.html('');
85 | authButton.$elem.attr('disabled', false);
86 | }
87 | }
88 | },
89 |
90 | jsClearField: function () {
91 | $('.js-clear-field').each(function () {
92 | let $clearField = $(this),
93 | $clearInput = $clearField.find('.js-clear-field-input'),
94 | $clearBtn = $clearField.find('.js-clear-field-btn');
95 |
96 | toggleValue($clearInput, $clearBtn);
97 |
98 | $clearInput.on('input', function () {
99 | toggleValue($(this), $clearBtn);
100 | });
101 |
102 | $clearBtn.on('click', function () {
103 | $clearInput.val('');
104 | $(this).hide();
105 | });
106 | });
107 | }
108 | };
109 |
110 | function toggleValue($clearInput, $clearBtn) {
111 | let value = $clearInput.val();
112 |
113 | if (value) {
114 | $clearBtn.show();
115 | } else {
116 | $clearBtn.hide();
117 | }
118 | }
119 |
120 | window.loader = {
121 | show: function ($target) {
122 | $('', {class: 'loader'}).appendTo($target);
123 | },
124 |
125 | hide: function ($target) {
126 | $target.find('.loader').remove();
127 | }
128 | };
129 |
130 | mindboxSettingDefault.jsMask();
131 | mindboxSettingDefault.jsTimer();
132 | mindboxSettingDefault.jsClearField();
133 | });
--------------------------------------------------------------------------------
/install/js/tracker.js:
--------------------------------------------------------------------------------
1 | mindbox = window.mindbox || function() { mindbox.queue.push(arguments); };
2 | mindbox.queue = mindbox.queue || [];
3 | mindbox('create', {
4 | endpointId: '#endpointId#'
5 | });
6 |
--------------------------------------------------------------------------------
/install/js/tracker.js.orig:
--------------------------------------------------------------------------------
1 | mindbox = window.mindbox || function() { mindbox.queue.push(arguments); };
2 | mindbox.queue = mindbox.queue || [];
3 | mindbox('create', {
4 | endpointId: '#endpointId#'
5 | });
--------------------------------------------------------------------------------
/install/step1.php:
--------------------------------------------------------------------------------
1 | GetException()) {
9 | echo CAdminMessage::ShowMessage(Array(
10 | "TYPE" => "ERROR",
11 | "MESSAGE" => GetMessage("MOD_INST_ERR"),
12 | "DETAILS" => $ex->GetString(),
13 | "HTML" => true,
14 | ));
15 | } else {
16 | echo CAdminMessage::ShowNote(GetMessage("MOD_INST_OK"));
17 | echo CAdminMessage::ShowMessage(array(
18 | "TYPE" => "WARNING",
19 | "MESSAGE" => GetMessage("SETTINGS_REMINDER"),
20 | "DETAILS" => '',
21 | "HTML" => true,
22 | ));
23 | }
24 | ?>
25 |
26 |
27 |
--------------------------------------------------------------------------------
/install/unstep1.php:
--------------------------------------------------------------------------------
1 |
8 |
19 |
--------------------------------------------------------------------------------
/install/unstep2.php:
--------------------------------------------------------------------------------
1 | GetException())
7 | echo CAdminMessage::ShowMessage(array(
8 | "TYPE" => "ERROR",
9 | "MESSAGE" => GetMessage("MOD_UNINST_ERR"),
10 | "DETAILS" => $ex->GetString(),
11 | "HTML" => true,
12 | ));
13 | else
14 | echo CAdminMessage::ShowNote(GetMessage("MOD_UNINST_OK"));
15 | ?>
16 |
17 |