iwgt 2.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,1403 @@
1
+ {
2
+ "version": "2.0",
3
+ "generatedAt": "2025-10-07T06:52:19.540Z",
4
+ "description": "Справочник по библиотеке common.v2.js для InSales - набор готовых скриптов для разработки шаблонов",
5
+ "installation": {
6
+ "method": "liquid_tag",
7
+ "code": "{% include_insales_scripts \"common-js@v2\" %}",
8
+ "alternative": "Добавить \"common_js_version\": \"v2\" в settings_data.json"
9
+ },
10
+ "dependencies": [
11
+ {
12
+ "name": "Lodash",
13
+ "version": "4.17.21",
14
+ "url": "https://lodash.com/"
15
+ },
16
+ {
17
+ "name": "jQuery",
18
+ "version": "latest",
19
+ "url": "http://jquery.com/"
20
+ }
21
+ ],
22
+ "globalObjects": [
23
+ {
24
+ "global": "localforage",
25
+ "module": "localForage",
26
+ "description": ""
27
+ },
28
+ {
29
+ "global": "Template",
30
+ "module": "Template",
31
+ "description": "Lodash шаблонизатор для работы с динамическими данными"
32
+ },
33
+ {
34
+ "global": "EventBus",
35
+ "module": "EventBus",
36
+ "description": "Шина событий для взаимодействия между компонентами"
37
+ },
38
+ {
39
+ "global": "Shop",
40
+ "module": "Shop",
41
+ "description": "Вспомогательные методы магазина (форматирование цен, конфигурация)"
42
+ },
43
+ {
44
+ "global": "InsalesCommonCart",
45
+ "module": "InsalesCommonCart",
46
+ "description": "Управление корзиной магазина"
47
+ },
48
+ {
49
+ "global": "Cart",
50
+ "module": "window",
51
+ "description": ""
52
+ },
53
+ {
54
+ "global": "Compare",
55
+ "module": "Compare",
56
+ "description": "Управление списком сравнения товаров"
57
+ },
58
+ {
59
+ "global": "FavoritesProducts",
60
+ "module": "FavoritesProducts",
61
+ "description": "Управление списком избранных товаров"
62
+ },
63
+ {
64
+ "global": "ajaxAPI",
65
+ "module": "ajaxAPI",
66
+ "description": "API для работы с данными магазина через AJAX"
67
+ },
68
+ {
69
+ "global": "Products",
70
+ "module": "Products",
71
+ "description": "Управление товарами и их вариантами"
72
+ },
73
+ {
74
+ "global": "AjaxSearch",
75
+ "module": "AjaxSearch",
76
+ "description": "Живой поиск по товарам"
77
+ },
78
+ {
79
+ "global": "reCaptchaCommon",
80
+ "module": "reCaptchaCommon",
81
+ "description": "Интеграция Google reCAPTCHA"
82
+ },
83
+ {
84
+ "global": "yandexCaptchaCommon",
85
+ "module": "yandexCaptchaCommon",
86
+ "description": "Интеграция Яндекс SmartCaptcha"
87
+ },
88
+ {
89
+ "global": "Tools",
90
+ "module": "Tools",
91
+ "description": "Набор вспомогательных утилит"
92
+ }
93
+ ],
94
+ "categories": [
95
+ {
96
+ "id": "product",
97
+ "name": "Работа с товарами",
98
+ "description": "Управление товарами, вариантами, опциями и модификациями",
99
+ "modules": [
100
+ "Products",
101
+ "ajaxAPI.product"
102
+ ]
103
+ },
104
+ {
105
+ "id": "cart",
106
+ "name": "Корзина",
107
+ "description": "Управление корзиной, добавление/удаление товаров, купоны",
108
+ "modules": [
109
+ "Cart",
110
+ "ajaxAPI.cart"
111
+ ]
112
+ },
113
+ {
114
+ "id": "lists",
115
+ "name": "Списки товаров",
116
+ "description": "Сравнение, избранное, недавно просмотренные",
117
+ "modules": [
118
+ "Compare",
119
+ "FavoritesProducts",
120
+ "ajaxAPI.compare",
121
+ "ajaxAPI.favorites"
122
+ ]
123
+ },
124
+ {
125
+ "id": "search",
126
+ "name": "Поиск",
127
+ "description": "Живой поиск по товарам и категориям",
128
+ "modules": [
129
+ "AjaxSearch"
130
+ ]
131
+ },
132
+ {
133
+ "id": "forms",
134
+ "name": "Формы",
135
+ "description": "Отзывы, комментарии, обратная связь, оформление заказа",
136
+ "modules": [
137
+ "ajaxAPI.shop"
138
+ ]
139
+ },
140
+ {
141
+ "id": "events",
142
+ "name": "События",
143
+ "description": "Шина событий для взаимодействия компонентов",
144
+ "modules": [
145
+ "EventBus"
146
+ ]
147
+ },
148
+ {
149
+ "id": "helpers",
150
+ "name": "Вспомогательные",
151
+ "description": "Шаблонизатор, форматирование, утилиты",
152
+ "modules": [
153
+ "Shop",
154
+ "Template",
155
+ "Tools"
156
+ ]
157
+ },
158
+ {
159
+ "id": "checkout",
160
+ "name": "Оформление заказа",
161
+ "description": "Быстрый заказ, оформление заказа",
162
+ "modules": [
163
+ "ajaxAPI.checkout"
164
+ ]
165
+ }
166
+ ],
167
+ "modules": [
168
+ {
169
+ "name": "overview",
170
+ "displayName": "Введение",
171
+ "description": "Раздел посвящен библиотеке `common.v2.js`, которая является набором готовых скриптов для упрощения и ускорения разработки шаблонов на платформе inSales.",
172
+ "methods": [],
173
+ "attributes": [],
174
+ "events": [],
175
+ "examples": []
176
+ },
177
+ {
178
+ "name": "Products",
179
+ "displayName": "Товары",
180
+ "description": "Модуль поддерживает декларативную работу через data-атрибуты: большинство функций работают автоматически при добавлении соответствующих атрибутов в HTML без необходимости писать JavaScript код.",
181
+ "methods": [
182
+ {
183
+ "name": "get",
184
+ "fullName": "Products.get",
185
+ "description": "Получить объект с информацией о конкретном товаре",
186
+ "parameters": [
187
+ {
188
+ "name": "id",
189
+ "type": "number",
190
+ "description": "id товара"
191
+ }
192
+ ],
193
+ "returns": {
194
+ "type": "Deferred",
195
+ "description": "*/"
196
+ },
197
+ "example": "/**\n * @param {number} id id товара\n * @return {Deferred}\n */\nProducts.get(123456)\n .done(function (onDone) { console.log('onDone', onDone) })\n .fail(function (onFail) { console.log('onFail', onFail) });",
198
+ "events": []
199
+ },
200
+ {
201
+ "name": "getList",
202
+ "fullName": "Products.getList",
203
+ "description": "Получение списка товаров",
204
+ "parameters": [
205
+ {
206
+ "name": "idList",
207
+ "type": "Array",
208
+ "description": "массив, состоящий из id товаров"
209
+ }
210
+ ],
211
+ "returns": {
212
+ "type": "Deferred",
213
+ "description": "*/"
214
+ },
215
+ "example": "/**\n * @param {Array} idList - массив, состоящий из id товаров\n * @return {Deferred}\n */\nProducts.getList([123456, 123455, 1234454, 123458])\n .done(function (onDone) { console.log('onDone', onDone) })\n .fail(function (onFail) { console.log('onFail', onFail) });",
216
+ "events": []
217
+ },
218
+ {
219
+ "name": "setConfig",
220
+ "fullName": "Products.setConfig",
221
+ "description": "Обновление настроек",
222
+ "parameters": [],
223
+ "returns": null,
224
+ "example": "Products.setConfig({\n showVariants: true,\n hideSelect: true,\n initOption: true,\n fileUrl: (typeof fileUrl == 'undefined') ? {} : fileUrl,\n filtered: true,\n selectUnavailable: true\n})",
225
+ "events": []
226
+ },
227
+ {
228
+ "name": "getInstance",
229
+ "fullName": "Products.getInstance",
230
+ "description": "Получаем экземпляр класса ProductInstance из jQuery DOM element",
231
+ "parameters": [],
232
+ "returns": null,
233
+ "example": "/**\n * @param {jQuery DOM element} $node jQuery DOM element например $('.product-cart-control')\n */\n Products.getInstance($('.product-cart-control'))\n .done(function (onDone) { console.log('onDone', onDone) })\n .fail(function (onFail) { console.log('onFail', onFail) });",
234
+ "events": []
235
+ },
236
+ {
237
+ "name": "initInstance",
238
+ "fullName": "Products.initInstance",
239
+ "description": "Инициализация формы товара",
240
+ "parameters": [],
241
+ "returns": null,
242
+ "example": "/**\n * @param {jQuery DOM element} $node jQuery DOM element например $('.product-cart-control')\n */\nProducts.initInstance($('.product-cart-control'))\n .done(function (onDone) { console.log('onDone', onDone) })\n .fail(function (onFail) { console.log('onFail', onFail) });",
243
+ "events": []
244
+ },
245
+ {
246
+ "name": "getRecentlyViewed",
247
+ "fullName": "Products.getRecentlyViewed",
248
+ "description": "Возвращает массив с ID просмотренных товаров",
249
+ "parameters": [],
250
+ "returns": null,
251
+ "example": "Products.getRecentlyViewed()\n .done(function (onDone) { console.log('onDone', onDone) })\n .fail(function (onFail) { console.log('onFail', onFail) });",
252
+ "events": []
253
+ }
254
+ ],
255
+ "attributes": [
256
+ {
257
+ "name": "data-product-id",
258
+ "description": "Обязательный атрибут для инициализации товара, принимает ID товара",
259
+ "example": null
260
+ },
261
+ {
262
+ "name": "data-product-without-cache",
263
+ "description": "Отключить кэширование информации о товаре",
264
+ "example": null
265
+ },
266
+ {
267
+ "name": "data-product-json",
268
+ "description": "Позволяет передать данные о товаре через Liquid. Это может ускорить отображение селектора вариантов.",
269
+ "example": null
270
+ },
271
+ {
272
+ "name": "data-product-without-many-variants",
273
+ "description": "Если в карточке товара отсутствует селектор выбора варианта, то рекомендуется указать данный атрибут со значение `true`. Тогда при запросе на сервер товар будет получен только с первым вариантом. Это может значительно ускорить загрузку страницы. Рекомендуется использовать в превью товаров, например,",
274
+ "example": null
275
+ },
276
+ {
277
+ "name": "data-set-config",
278
+ "description": "Передать настройки товара через data-атрибут",
279
+ "example": null
280
+ },
281
+ {
282
+ "name": "data-product-variants",
283
+ "description": "Каждый вариант товара состоит из свойств и их значений, например: \"Цвет: Красный, Размер: 42\", \"Цвет: Синий, Размер: 38\".",
284
+ "example": null
285
+ },
286
+ {
287
+ "name": "data-quantity",
288
+ "description": "Обязательный атрибут для обёртки кнопок изменения количества и инпута quantity",
289
+ "example": null
290
+ },
291
+ {
292
+ "name": "data-quantity-change",
293
+ "description": "Атрибут для кнопок изменения количества +/-, принимает число",
294
+ "example": null
295
+ },
296
+ {
297
+ "name": "data-item-add",
298
+ "description": "Добавление товара в корзину",
299
+ "example": null
300
+ },
301
+ {
302
+ "name": "data-add-cart-counter",
303
+ "description": "Компонент, который совмещает в себе функционал добавления товара в корзину, изменения количества, отображения счётчика и возможность удаления из корзины. Он используется в виджетах карточек товаров в шаблонах 4 поколения.",
304
+ "example": "EventBus.subscribe('unchange_quantity:insales:ui_add-cart-counter', data => {\n console.log(data);\n})"
305
+ },
306
+ {
307
+ "name": "data-product-card-preorder",
308
+ "description": "Атрибут предназначен для кнопки вызова формы предзаказа. При загрузке страницы кнопка получает атрибуты `data-preorder-product-name` и `data-preorder-variant`, которые содержат название товара и название выбранного варианта.",
309
+ "example": null
310
+ },
311
+ {
312
+ "name": "data-quick-checkout",
313
+ "description": "Форма заказа в один клик",
314
+ "example": null
315
+ },
316
+ {
317
+ "name": "data-product-card-price",
318
+ "description": "Цена продажи варианта товара",
319
+ "example": null
320
+ },
321
+ {
322
+ "name": "data-product-card-price-from-cart",
323
+ "description": "Цена продажи варианта товара с учётом типов цен",
324
+ "example": null
325
+ },
326
+ {
327
+ "name": "data-product-card-zero-price-text",
328
+ "description": "Текст, который будет отображаться, если цена товара равна нулю. По умолчанию текст \"Цена по запросу\". Данный атрибут добавляется к элементу, в котором отображается цена товара (`data-product-card-price` или `data-product-card-price-from-cart`).",
329
+ "example": null
330
+ },
331
+ {
332
+ "name": "data-product-card-old-price",
333
+ "description": "Старая цена варианта товара",
334
+ "example": null
335
+ },
336
+ {
337
+ "name": "data-product-card-sku",
338
+ "description": "Получение артикула варианта товара. В качестве значения можно передать label.",
339
+ "example": null
340
+ },
341
+ {
342
+ "name": "data-product-card-available",
343
+ "description": "Наличие варианта товара.",
344
+ "example": null
345
+ }
346
+ ],
347
+ "events": [
348
+ {
349
+ "name": "init_instance:insales:product",
350
+ "description": "Срабатывает после инициализации оберток [data-product-id] с инициализацией всех дочерних элементов"
351
+ },
352
+ {
353
+ "name": "before:insales:product",
354
+ "description": "Срабатывает перед любым взаимодействием с компонентом товара"
355
+ },
356
+ {
357
+ "name": "always:insales:product",
358
+ "description": "Срабатывает после любого взаимодействия с компонентом товара"
359
+ },
360
+ {
361
+ "name": "change_quantity:insales:product",
362
+ "description": "Обновление количества товара в инпуте quantity"
363
+ },
364
+ {
365
+ "name": "unchange_quantity:insales:product",
366
+ "description": "Если введено кол-во больше доступного"
367
+ },
368
+ {
369
+ "name": "overload:quantity:insales:product",
370
+ "description": "Событие срабатывает, когда с помощью +/- накликали до максимального значения quantity (Работает, если вы используете параметр useMax)"
371
+ },
372
+ {
373
+ "name": "max:quantity:insales:product",
374
+ "description": "Срабатывает всегда, когда в инпуте установлено максимальное кол-во, даже при загрузке страницы (Работает, если вы используете параметр useMax)"
375
+ },
376
+ {
377
+ "name": "change_variant:insales:product",
378
+ "description": "Срабатывает при выборе варианта товара"
379
+ },
380
+ {
381
+ "name": "update_variant:insales:product",
382
+ "description": "Обновление варианта товара"
383
+ }
384
+ ],
385
+ "examples": [
386
+ {
387
+ "code": "<div class=\"add-cart-counter\" data-add-cart-counter='{\"step\": \"1\"}'>\n <button type=\"button\" class=\"add-cart-counter__btn\" data-add-cart-counter-btn>\n Add to cart\n </button>\n <div class=\"add-cart-counter__controls\">\n <button data-add-cart-counter-minus class=\"add-cart-counter__controls-btn\" type=\"button\">-</button>\n <a href=\"{{cart_url}}\" class=\"add-cart-counter__detail\">\n <span class=\"add-cart-counter__detail-text\">{{messages.btn_buy_active_text}} <span data-add-cart-counter-count></span> {{ product.unit }}</span>\n </a>\n <button data-add-cart-counter-plus class=\"add-cart-counter__controls-btn\" type=\"button\">+</button>\n </div>\n</div>",
388
+ "language": "html"
389
+ },
390
+ {
391
+ "code": "EventBus.subscribe('change_quantity:insales:product', function (data) {\n console.log('Изменено количество товара в счётчике', data);\n});",
392
+ "language": "javascript"
393
+ }
394
+ ]
395
+ },
396
+ {
397
+ "name": "Cart",
398
+ "displayName": "Корзина",
399
+ "description": "Модуль поддерживает декларативную работу через data-атрибуты: большинство функций работают автоматически при добавлении соответствующих атрибутов в HTML без необходимости писать JavaScript код.",
400
+ "methods": [
401
+ {
402
+ "name": "add",
403
+ "fullName": "Cart.add",
404
+ "description": "Добавить в корзину заданное количество вариантов товаров",
405
+ "parameters": [
406
+ {
407
+ "name": "items",
408
+ "type": "Object",
409
+ "description": "объект с параметрами variant_id: quantity"
410
+ },
411
+ {
412
+ "name": "items",
413
+ "type": "Object",
414
+ "description": ".accessoriable_variant_ids объект с параметрами variant_id: [{quantity: quantity, accessory_value_ids: {accessory_value_id: quantity}}]"
415
+ },
416
+ {
417
+ "name": "comments",
418
+ "type": "Object",
419
+ "description": "комментарий к позиции заказа. Ключ ID варианта, значение текст комментария"
420
+ },
421
+ {
422
+ "name": "coupon",
423
+ "type": "string",
424
+ "description": "купон"
425
+ }
426
+ ],
427
+ "returns": null,
428
+ "example": "/**\n * @param {Object} items объект с параметрами variant_id: quantity\n * @param {Object} items.accessoriable_variant_ids объект с параметрами variant_id: [{quantity: quantity, accessory_value_ids: {accessory_value_id: quantity}}]\n * @param {Object} comments комментарий к позиции заказа. Ключ ID варианта, значение текст комментария\n * @param {string} coupon купон\n */\n{\n items: {\n // Варианты товаров без опций\n 123456: 2,\n 123457: 1,\n\n // Варианты товаров с опциями\n accessoriable_variant_ids: {\n 123458: [\n {\n quantity: 1,\n accessory_value_ids: {\n 1234: 1,\n 1235: 1\n }\n },\n {\n quantity: 1,\n accessory_value_ids: {\n 1236: 1,\n 1237: 1\n }\n }\n ]\n }\n },\n comments: {\n 123457: 'Мой комментарий'\n },\n coupon: 'Мой купон'\n}",
429
+ "events": [
430
+ {
431
+ "name": "before:insales:cart",
432
+ "description": ""
433
+ },
434
+ {
435
+ "name": "add_items:insales:cart",
436
+ "description": ""
437
+ },
438
+ {
439
+ "name": "add_items:insales:cart:light",
440
+ "description": "в order_lines не будет объекта product"
441
+ },
442
+ {
443
+ "name": "update_items:insales:cart",
444
+ "description": ""
445
+ },
446
+ {
447
+ "name": "update_items:insales:cart:light",
448
+ "description": "в order_lines не будет объекта product"
449
+ },
450
+ {
451
+ "name": "always:insales:cart",
452
+ "description": ""
453
+ }
454
+ ]
455
+ },
456
+ {
457
+ "name": "delete",
458
+ "fullName": "Cart.delete",
459
+ "description": "Удалить позиции из корзины",
460
+ "parameters": [
461
+ {
462
+ "name": "items",
463
+ "type": "Array",
464
+ "description": "массив ID вариантов к удалению"
465
+ },
466
+ {
467
+ "name": "items",
468
+ "type": "Object",
469
+ "description": "объект с параметрами variant_id: variant_id"
470
+ },
471
+ {
472
+ "name": "items",
473
+ "type": "Object",
474
+ "description": ".accessoriable_variant_ids объект с параметрами variant_id: [{quantity: quantity, accessory_value_ids: {accessory_value_id: quantity}}]"
475
+ }
476
+ ],
477
+ "returns": null,
478
+ "example": "/**\n * @param {Array} items массив ID вариантов к удалению\n */\nCart.delete({\n items: [160549240, 160549242]\n})",
479
+ "events": [
480
+ {
481
+ "name": "before:insales:cart",
482
+ "description": ""
483
+ },
484
+ {
485
+ "name": "delete_items:insales:cart",
486
+ "description": ""
487
+ },
488
+ {
489
+ "name": "update_items:insales:cart",
490
+ "description": ""
491
+ },
492
+ {
493
+ "name": "update_items:insales:cart:light",
494
+ "description": "в order_lines не будет объекта product"
495
+ },
496
+ {
497
+ "name": "always:insales:cart",
498
+ "description": ""
499
+ }
500
+ ]
501
+ },
502
+ {
503
+ "name": "clear",
504
+ "fullName": "Cart.clear",
505
+ "description": "Полностью очистить корзину",
506
+ "parameters": [],
507
+ "returns": null,
508
+ "example": "Cart.clear();",
509
+ "events": [
510
+ {
511
+ "name": "before:insales:cart",
512
+ "description": ""
513
+ },
514
+ {
515
+ "name": "clear_items:insales:cart",
516
+ "description": ""
517
+ },
518
+ {
519
+ "name": "update_items:insales:cart",
520
+ "description": ""
521
+ },
522
+ {
523
+ "name": "update_items:insales:cart:light",
524
+ "description": "в order_lines не будет объекта product"
525
+ },
526
+ {
527
+ "name": "always:insales:cart",
528
+ "description": ""
529
+ }
530
+ ]
531
+ },
532
+ {
533
+ "name": "forceUpdate",
534
+ "fullName": "Cart.forceUpdate",
535
+ "description": "Принудительно обновить данные корзины",
536
+ "parameters": [],
537
+ "returns": null,
538
+ "example": "Cart.forceUpdate()",
539
+ "events": []
540
+ },
541
+ {
542
+ "name": "remove",
543
+ "fullName": "Cart.remove",
544
+ "description": "Удалить из корзины заданное количество вариантов товаров",
545
+ "parameters": [
546
+ {
547
+ "name": "items",
548
+ "type": "Object",
549
+ "description": "объект с параметрами variant_id: quantity"
550
+ },
551
+ {
552
+ "name": "items",
553
+ "type": "Object",
554
+ "description": ".accessoriable_variant_ids объект с параметрами variant_id: [{quantity: quantity, accessory_value_ids: {accessory_value_id: quantity}}]"
555
+ }
556
+ ],
557
+ "returns": null,
558
+ "example": "/**\n* @param {Object} items объект с параметрами variant_id: quantity\n* @param {Object} items.accessoriable_variant_ids объект с параметрами variant_id: [{quantity: quantity, accessory_value_ids: {accessory_value_id: quantity}}]\n*/\nCart.remove({\n items: {\n // Варианты товаров без опций\n 138231315: 1,\n 138231316: 1,\n\n // Варианты товаров с опциями\n accessoriable_variant_ids: {\n 138231317: [\n {\n quantity: 1,\n accessory_value_ids: {\n 1234: 1,\n 1235: 1\n }\n },\n {\n quantity: 1,\n accessory_value_ids: {\n 1236: 1,\n 1237: 1\n }\n }\n ]\n }\n }\n})",
559
+ "events": [
560
+ {
561
+ "name": "before:insales:cart",
562
+ "description": ""
563
+ },
564
+ {
565
+ "name": "remove_items:insales:cart",
566
+ "description": ""
567
+ },
568
+ {
569
+ "name": "update_items:insales:cart",
570
+ "description": ""
571
+ },
572
+ {
573
+ "name": "update_items:insales:cart:light",
574
+ "description": "в order_lines не будет объекта product"
575
+ },
576
+ {
577
+ "name": "always:insales:cart",
578
+ "description": ""
579
+ }
580
+ ]
581
+ },
582
+ {
583
+ "name": "set",
584
+ "fullName": "Cart.set",
585
+ "description": "Устанавливает количество для каждой позиции в корзине",
586
+ "parameters": [
587
+ {
588
+ "name": "items",
589
+ "type": "Object",
590
+ "description": "объект с параметрами variant_id: quantity"
591
+ },
592
+ {
593
+ "name": "items",
594
+ "type": "Object",
595
+ "description": ".accessoriable_variant_ids объект с параметрами variant_id: [{quantity: quantity, accessory_value_ids: {accessory_value_id: quantity}}]"
596
+ }
597
+ ],
598
+ "returns": null,
599
+ "example": "/**\n* @param {Object} items объект с параметрами variant_id: quantity\n* @param {Object} items.accessoriable_variant_ids объект с параметрами variant_id: [{quantity: quantity, accessory_value_ids: {accessory_value_id: quantity}}]\n*/\nCart.set({\n items: {\n // Позиции без опций\n 138231315: 1,\n 138231316: 1,\n\n // Позиции с опциями\n accessoriable_variant_ids: {\n 138231317: [\n {\n quantity: 1,\n accessory_value_ids: {\n 1234: 1,\n 1235: 1\n }\n },\n {\n quantity: 1,\n accessory_value_ids: {\n 1236: 1,\n 1237: 1\n }\n }\n ]\n }\n }\n})",
600
+ "events": [
601
+ {
602
+ "name": "before:insales:cart",
603
+ "description": ""
604
+ },
605
+ {
606
+ "name": "set_items:insales:cart",
607
+ "description": ""
608
+ },
609
+ {
610
+ "name": "update_items:insales:cart",
611
+ "description": ""
612
+ },
613
+ {
614
+ "name": "update_items:insales:cart:light",
615
+ "description": "в order_lines не будет объекта product"
616
+ },
617
+ {
618
+ "name": "always:insales:cart",
619
+ "description": ""
620
+ }
621
+ ]
622
+ },
623
+ {
624
+ "name": "setCoupon",
625
+ "fullName": "Cart.setCoupon",
626
+ "description": "Устанавливает купон",
627
+ "parameters": [
628
+ {
629
+ "name": "coupon",
630
+ "type": "string",
631
+ "description": "код купона"
632
+ }
633
+ ],
634
+ "returns": null,
635
+ "example": "/**\n* @param {string} coupon код купона\n*/\nCart.setCoupon({\n coupon: 'Мой купон'\n})",
636
+ "events": [
637
+ {
638
+ "name": "before:insales:cart",
639
+ "description": ""
640
+ },
641
+ {
642
+ "name": "set_coupon:insales:cart",
643
+ "description": ""
644
+ },
645
+ {
646
+ "name": "update_items:insales:cart",
647
+ "description": ""
648
+ },
649
+ {
650
+ "name": "update_items:insales:cart:light",
651
+ "description": "в order_lines не будет объекта product"
652
+ },
653
+ {
654
+ "name": "always:insales:cart",
655
+ "description": ""
656
+ }
657
+ ]
658
+ },
659
+ {
660
+ "name": "order.get",
661
+ "fullName": "Cart.order.get",
662
+ "description": "Получить состав корзины",
663
+ "parameters": [],
664
+ "returns": null,
665
+ "example": "var order = Cart.order.get();\nconsole.log(order);",
666
+ "events": []
667
+ },
668
+ {
669
+ "name": "order.getItemByID",
670
+ "fullName": "Cart.order.getItemByID",
671
+ "description": "Получить информацию о позиции по ID",
672
+ "parameters": [],
673
+ "returns": null,
674
+ "example": "var item = Cart.order.getItemByID(138231315);\nconsole.log(item);",
675
+ "events": []
676
+ }
677
+ ],
678
+ "attributes": [
679
+ {
680
+ "name": "data-cart-form",
681
+ "description": "Обязательный атрибут тега form",
682
+ "example": null
683
+ },
684
+ {
685
+ "name": "data-reload-on-coupon",
686
+ "description": "Перезагрузка страницы после применения купона. Чтобы отключить перезагрузку, нужно указать `false` в качестве значения",
687
+ "example": null
688
+ },
689
+ {
690
+ "name": "data-item-id",
691
+ "description": "Обязательный атрибут для позиций в корзине. В качестве значения необходимо передать ID позиции.",
692
+ "example": null
693
+ },
694
+ {
695
+ "name": "data-product-id",
696
+ "description": "Обязательный атрибут для инициализации товара. В качестве значения необходимо передать ID товара.",
697
+ "example": null
698
+ },
699
+ {
700
+ "name": "data-quantity",
701
+ "description": "Обязательный атрибут для обёртки кнопок изменения количества и инпута quantity",
702
+ "example": null
703
+ },
704
+ {
705
+ "name": "data-quantity-change",
706
+ "description": "Атрибут для кнопок изменения количества +/-, принимает число",
707
+ "example": null
708
+ },
709
+ {
710
+ "name": "data-cart-item-price",
711
+ "description": "Цена позиции товара",
712
+ "example": null
713
+ },
714
+ {
715
+ "name": "data-cart-item-total-price",
716
+ "description": "Итоговая цена позиции товара в зависимости от его количества",
717
+ "example": null
718
+ },
719
+ {
720
+ "name": "data-cart-total-price",
721
+ "description": "Итоговая цена всех позиций в корзине без учёта скидок",
722
+ "example": null
723
+ },
724
+ {
725
+ "name": "data-cart-full-total-price",
726
+ "description": "Итоговая цена всех позиций в корзине с учётом скидок",
727
+ "example": null
728
+ },
729
+ {
730
+ "name": "data-cart-positions-count",
731
+ "description": "Количество позиций в корзине",
732
+ "example": null
733
+ },
734
+ {
735
+ "name": "data-cart-item-count",
736
+ "description": "Количество товаров в корзине",
737
+ "example": null
738
+ },
739
+ {
740
+ "name": "data-item-delete",
741
+ "description": "Кнопка удаления позиции из корзины",
742
+ "example": null
743
+ },
744
+ {
745
+ "name": "data-cart-discounts-ajax",
746
+ "description": "Получение и вывод информации о скидках (в форму корзины нужно добавить `data-reload-on-coupon=\"false\"`)",
747
+ "example": null
748
+ },
749
+ {
750
+ "name": "data-cart-discounts-error",
751
+ "description": "Элемент, в котором будут выводиться ошибки при вводе купона или применении других скидок",
752
+ "example": null
753
+ },
754
+ {
755
+ "name": "data-cart-clear",
756
+ "description": "Кнопка очистки корзины",
757
+ "example": null
758
+ },
759
+ {
760
+ "name": "data-coupon-submit",
761
+ "description": "Кнопка отправки купона",
762
+ "example": null
763
+ }
764
+ ],
765
+ "events": [
766
+ {
767
+ "name": "before:insales:cart",
768
+ "description": ""
769
+ },
770
+ {
771
+ "name": "add_items:insales:cart",
772
+ "description": ""
773
+ },
774
+ {
775
+ "name": "add_items:insales:cart:light",
776
+ "description": "в order_lines не будет объекта product"
777
+ },
778
+ {
779
+ "name": "update_items:insales:cart",
780
+ "description": ""
781
+ },
782
+ {
783
+ "name": "update_items:insales:cart:light",
784
+ "description": "в order_lines не будет объекта product"
785
+ },
786
+ {
787
+ "name": "always:insales:cart",
788
+ "description": ""
789
+ },
790
+ {
791
+ "name": "delete_items:insales:cart",
792
+ "description": ""
793
+ },
794
+ {
795
+ "name": "clear_items:insales:cart",
796
+ "description": ""
797
+ },
798
+ {
799
+ "name": "remove_items:insales:cart",
800
+ "description": ""
801
+ },
802
+ {
803
+ "name": "set_items:insales:cart",
804
+ "description": ""
805
+ },
806
+ {
807
+ "name": "set_coupon:insales:cart",
808
+ "description": ""
809
+ },
810
+ {
811
+ "name": "before:insales:item",
812
+ "description": ""
813
+ },
814
+ {
815
+ "name": "change_quantity:insales:item",
816
+ "description": ""
817
+ },
818
+ {
819
+ "name": "update_variant:insales:item",
820
+ "description": ""
821
+ },
822
+ {
823
+ "name": "always:insales:item",
824
+ "description": ""
825
+ }
826
+ ],
827
+ "examples": []
828
+ },
829
+ {
830
+ "name": "AjaxSearch",
831
+ "displayName": "Поиск",
832
+ "description": "",
833
+ "methods": [
834
+ {
835
+ "name": "setConfig",
836
+ "fullName": "AjaxSearch.setConfig",
837
+ "description": "Обновление настроек",
838
+ "parameters": [
839
+ {
840
+ "name": "letters",
841
+ "type": "number",
842
+ "description": "с какого символа начинать поиск"
843
+ },
844
+ {
845
+ "name": "delay",
846
+ "type": "number",
847
+ "description": "задержка между запросами"
848
+ },
849
+ {
850
+ "name": "hide_items_out_of_stock",
851
+ "type": "boolean",
852
+ "description": "нужно ли скрывать товары, которых нет в наличии"
853
+ }
854
+ ],
855
+ "returns": null,
856
+ "example": "/**\n * @param {number} letters с какого символа начинать поиск\n * @param {number} delay задержка между запросами\n * @param {boolean} hide_items_out_of_stock нужно ли скрывать товары, которых нет в наличии\n */\n\n AjaxSearch.setConfig({\n letters: 3,\n delay: 300,\n hide_items_out_of_stock: true\n });",
857
+ "events": []
858
+ }
859
+ ],
860
+ "attributes": [],
861
+ "events": [
862
+ {
863
+ "name": "before:insales:search",
864
+ "description": "Срабатывает перед любым взаимодействием с компонентом поиска"
865
+ },
866
+ {
867
+ "name": "update:insales:search",
868
+ "description": "Срабатывает после обновления результатов поиска"
869
+ },
870
+ {
871
+ "name": "always:insales:search",
872
+ "description": "Срабатывает после любого взаимодействия с компонентом поиска"
873
+ }
874
+ ],
875
+ "examples": [
876
+ {
877
+ "code": "EventBus.subscribe('update:insales:search', function (data) {\n console.log(data);\n});",
878
+ "language": "javascript"
879
+ }
880
+ ]
881
+ },
882
+ {
883
+ "name": "Compare",
884
+ "displayName": "Сравнение",
885
+ "description": "Страница сравнения доступна во всех магазинах по адресу `/compares`. Чтобы отредактировать содержимое страницы, добавьте в папку `templates` файл `compare.liquid`. Массив товаров будет доступен в Liquid-переменной `products`. В сравнение можно добавлять только товары, выбранные варианты не сохраняют",
886
+ "methods": [
887
+ {
888
+ "name": "getCompare",
889
+ "fullName": "Compare.getCompare",
890
+ "description": "Получить текущее состояние сравнения",
891
+ "parameters": [],
892
+ "returns": null,
893
+ "example": "var compareState = Compare.getCompare();\nconsole.log(compareState);",
894
+ "events": []
895
+ },
896
+ {
897
+ "name": "add",
898
+ "fullName": "Compare.add",
899
+ "description": "Добавить товар в сравнение",
900
+ "parameters": [
901
+ {
902
+ "name": "item",
903
+ "type": "number",
904
+ "description": "ID товара"
905
+ }
906
+ ],
907
+ "returns": null,
908
+ "example": "/**\n * @param {number} item ID товара\n */\nCompare.add({\n item: 123456\n});",
909
+ "events": []
910
+ },
911
+ {
912
+ "name": "remove",
913
+ "fullName": "Compare.remove",
914
+ "description": "Удалить товар из сравнения",
915
+ "parameters": [
916
+ {
917
+ "name": "item",
918
+ "type": "number",
919
+ "description": "ID товара"
920
+ }
921
+ ],
922
+ "returns": null,
923
+ "example": "/**\n * @param {number} item ID товара\n */\nCompare.remove({\n item: 123456\n});",
924
+ "events": []
925
+ },
926
+ {
927
+ "name": "clear",
928
+ "fullName": "Compare.clear",
929
+ "description": "Удалить все товары из сравнения",
930
+ "parameters": [],
931
+ "returns": null,
932
+ "example": "Compare.clear();",
933
+ "events": []
934
+ },
935
+ {
936
+ "name": "update",
937
+ "fullName": "Compare.update",
938
+ "description": "Обновить состояние сравнения",
939
+ "parameters": [],
940
+ "returns": null,
941
+ "example": "Compare.update();",
942
+ "events": []
943
+ }
944
+ ],
945
+ "attributes": [],
946
+ "events": [
947
+ {
948
+ "name": "before:insales:compares",
949
+ "description": "Срабатывает перед любым взаимодействием с компонентом сравнения"
950
+ },
951
+ {
952
+ "name": "always:insales:compares",
953
+ "description": "Срабатывает после любого взаимодействия с компонентом сравнения"
954
+ },
955
+ {
956
+ "name": "update_items:insales:compares",
957
+ "description": "Обновление товаров в сравнении"
958
+ },
959
+ {
960
+ "name": "add_item:insales:compares",
961
+ "description": "Добавление товара в сравнение"
962
+ },
963
+ {
964
+ "name": "remove_item:insales:compares",
965
+ "description": "Удаление товара из сравнения"
966
+ },
967
+ {
968
+ "name": "overload:insales:compares",
969
+ "description": "Достигнуто максимальное количество товаров в сравнении"
970
+ }
971
+ ],
972
+ "examples": [
973
+ {
974
+ "code": "EventBus.subscribe('add_item:insales:compares', function (data) {\n console.log('Товар добавлен в сравнение', data);\n});",
975
+ "language": "javascript"
976
+ }
977
+ ]
978
+ },
979
+ {
980
+ "name": "FavoritesProducts",
981
+ "displayName": "Избранное",
982
+ "description": "Страница избранного доступна во всех магазинах по адресу `/favorites`. Чтобы отредактировать содержимое страницы, добавьте в папку `templates` файл `favorite.liquid`. Массив товаров будет доступен в Liquid-переменной `products`. В избранные можно добавлять только товары, выбранные варианты не сохран",
983
+ "methods": [
984
+ {
985
+ "name": "getFavoritesProducts",
986
+ "fullName": "FavoritesProducts.getFavoritesProducts",
987
+ "description": "Получить текущее состояние избранного",
988
+ "parameters": [],
989
+ "returns": null,
990
+ "example": "var favoritesState = FavoritesProducts.getFavoritesProducts();\nconsole.log(favoritesState);",
991
+ "events": []
992
+ },
993
+ {
994
+ "name": "add",
995
+ "fullName": "FavoritesProducts.add",
996
+ "description": "Добавить товар в избранное",
997
+ "parameters": [
998
+ {
999
+ "name": "item",
1000
+ "type": "number",
1001
+ "description": "ID товара"
1002
+ }
1003
+ ],
1004
+ "returns": null,
1005
+ "example": "/**\n * @param {number} item ID товара\n */\nFavoritesProducts.add({\n item: 123456\n});",
1006
+ "events": []
1007
+ },
1008
+ {
1009
+ "name": "remove",
1010
+ "fullName": "FavoritesProducts.remove",
1011
+ "description": "Удалить товар из избранного",
1012
+ "parameters": [
1013
+ {
1014
+ "name": "item",
1015
+ "type": "number",
1016
+ "description": "ID товара"
1017
+ }
1018
+ ],
1019
+ "returns": null,
1020
+ "example": "/**\n * @param {number} item ID товара\n */\nFavoritesProducts.remove({\n item: 123456\n});",
1021
+ "events": []
1022
+ },
1023
+ {
1024
+ "name": "clear",
1025
+ "fullName": "FavoritesProducts.clear",
1026
+ "description": "Очистить избранное",
1027
+ "parameters": [],
1028
+ "returns": null,
1029
+ "example": "FavoritesProducts.remove();",
1030
+ "events": []
1031
+ },
1032
+ {
1033
+ "name": "update",
1034
+ "fullName": "FavoritesProducts.update",
1035
+ "description": "Обновить состояние",
1036
+ "parameters": [],
1037
+ "returns": null,
1038
+ "example": "FavoritesProducts.update();",
1039
+ "events": []
1040
+ }
1041
+ ],
1042
+ "attributes": [],
1043
+ "events": [
1044
+ {
1045
+ "name": "before:insales:favorites_products",
1046
+ "description": "Срабатывает перед любым взаимодействием с компонентом избранного"
1047
+ },
1048
+ {
1049
+ "name": "always:insales:favorites_products",
1050
+ "description": "Срабатывает после любого взаимодействия с компонентом избранного"
1051
+ },
1052
+ {
1053
+ "name": "update_items:insales:favorites_products",
1054
+ "description": "Список избранного обновлен"
1055
+ },
1056
+ {
1057
+ "name": "add_item:insales:favorites_products",
1058
+ "description": "Товар добавлен в избранное"
1059
+ },
1060
+ {
1061
+ "name": "remove_item:insales:favorites_products",
1062
+ "description": "Товар удален из избранного"
1063
+ },
1064
+ {
1065
+ "name": "overload:insales:favorites_products",
1066
+ "description": "Достигнуто максимальное количество избранных товаров"
1067
+ }
1068
+ ],
1069
+ "examples": [
1070
+ {
1071
+ "code": "EventBus.subscribe('add_item:insales:favorites_products', function (data) {\n console.log('Товар добавлен в избранное', data);\n});",
1072
+ "language": "javascript"
1073
+ }
1074
+ ]
1075
+ },
1076
+ {
1077
+ "name": "EventBus",
1078
+ "displayName": "Шина событий",
1079
+ "description": "EventBus (шина событий) предназначена для простого взаимодействия базового функционала с остальными скриптами, не привязываясь при этом к верстке и вспомогательным объектам. Работает по принципу Pub/Sub (Издатель/Подписчик) и построена на Deferred, что позволяет: * привязать к одному событию (Изда",
1080
+ "methods": [
1081
+ {
1082
+ "name": "subscribe",
1083
+ "fullName": "EventBus.subscribe",
1084
+ "description": "В работе с API необходимо привязываться к подписчикам, так как издатели объявлены внутри API. Например, при добавлении товара в корзину внутри API публикуется событие `add_items:insales:cart`:",
1085
+ "parameters": [
1086
+ {
1087
+ "name": "eventId",
1088
+ "type": "String",
1089
+ "description": "название события"
1090
+ },
1091
+ {
1092
+ "name": "callback",
1093
+ "type": "function",
1094
+ "description": "функция обработчик события"
1095
+ }
1096
+ ],
1097
+ "returns": null,
1098
+ "example": "EventBus.publish('add_items:insales:cart', data);",
1099
+ "events": []
1100
+ },
1101
+ {
1102
+ "name": "publish",
1103
+ "fullName": "EventBus.publish",
1104
+ "description": "Публикация события",
1105
+ "parameters": [
1106
+ {
1107
+ "name": "eventId",
1108
+ "type": "String",
1109
+ "description": "название события"
1110
+ },
1111
+ {
1112
+ "name": "data",
1113
+ "type": "Object",
1114
+ "description": "любой тип данных, преимущественно `Object`"
1115
+ }
1116
+ ],
1117
+ "returns": null,
1118
+ "example": "/**\n * @param {String} eventId название события\n * @param {Object} data любой тип данных, преимущественно `Object`\n */",
1119
+ "events": []
1120
+ },
1121
+ {
1122
+ "name": "logger.add",
1123
+ "fullName": "EventBus.logger.add",
1124
+ "description": "Добавление логера для компонента",
1125
+ "parameters": [
1126
+ {
1127
+ "name": "componentTitle",
1128
+ "type": "String",
1129
+ "description": "название компонента"
1130
+ }
1131
+ ],
1132
+ "returns": null,
1133
+ "example": "/**\n * @param {String} componentTitle название компонента\n */\nEventBus.logger.add('cart')",
1134
+ "events": []
1135
+ }
1136
+ ],
1137
+ "attributes": [],
1138
+ "events": [],
1139
+ "examples": [
1140
+ {
1141
+ "code": "EventBus.subscribe('event_id', function (data) {\n console.log(data)\n});\n\nEventBus.subscribe('add_items:insales:cart', function (data) {\n console.log('Товар добавлен');\n});",
1142
+ "language": "javascript"
1143
+ },
1144
+ {
1145
+ "code": "EventBus.publish('event_id', {\n isTest: true,\n title: 'Test',\n status: 'ok'\n});",
1146
+ "language": "javascript"
1147
+ },
1148
+ {
1149
+ "code": "EventBus.logger.add('cart')\nEventBus.logger.add('product')",
1150
+ "language": "javascript"
1151
+ }
1152
+ ]
1153
+ },
1154
+ {
1155
+ "name": "ajaxAPI",
1156
+ "displayName": "AJAX API",
1157
+ "description": "",
1158
+ "methods": [
1159
+ {
1160
+ "name": "add",
1161
+ "fullName": "ajaxAPI.add",
1162
+ "description": "Добавление товаров в корзину",
1163
+ "parameters": [],
1164
+ "returns": null,
1165
+ "example": "ajaxAPI.cart.add({\n 123456: 1,\n 123457: 3,\n 123450: 100\n }, {\n comments: { 123456: 'Ваш комментарий' },\n coupon: 'test'\n })\n .done(function (onDone) { console.log ('onDone: ', onDone) })\n .fail(function (onFail) { console.log ('onFail:', onFail) });",
1166
+ "events": []
1167
+ },
1168
+ {
1169
+ "name": "get",
1170
+ "fullName": "ajaxAPI.get",
1171
+ "description": "Получение состава корзины",
1172
+ "parameters": [],
1173
+ "returns": null,
1174
+ "example": "ajaxAPI.cart.get()\n .done(function (onDone) { console.log ('onDone: ', onDone) })\n .fail(function (onFail) { console.log ('onFail:', onFail) });",
1175
+ "events": []
1176
+ },
1177
+ {
1178
+ "name": "remove",
1179
+ "fullName": "ajaxAPI.remove",
1180
+ "description": "Удаление товара из корзины",
1181
+ "parameters": [
1182
+ {
1183
+ "name": "variant_id",
1184
+ "type": "Number",
1185
+ "description": "id модификации"
1186
+ }
1187
+ ],
1188
+ "returns": null,
1189
+ "example": "/**\n * @param {Number} variant_id - id модификации\n */\najaxAPI.cart.remove(123123)\n .done(function (onDone) { console.log ('onDone: ', onDone) })\n .fail(function (onFail) { console.log ('onFail:', onFail) });",
1190
+ "events": []
1191
+ },
1192
+ {
1193
+ "name": "update",
1194
+ "fullName": "ajaxAPI.update",
1195
+ "description": "Обновление состава корзины.",
1196
+ "parameters": [
1197
+ {
1198
+ "name": "items",
1199
+ "type": "Object",
1200
+ "description": "набор пар {variant_id: quantity, ...}. Если quantity = 0, то позиция удаляется из корзины, в противном случае устанавливается указанное кол-во"
1201
+ },
1202
+ {
1203
+ "name": "options",
1204
+ "type": "Object",
1205
+ "description": "дополнительные поля: comments, coupon"
1206
+ },
1207
+ {
1208
+ "name": "options",
1209
+ "type": "Object",
1210
+ "description": ".comments - объект с комментариями вида {variant_id: comment, ...}"
1211
+ },
1212
+ {
1213
+ "name": "options",
1214
+ "type": "String",
1215
+ "description": ".coupon - название купона"
1216
+ }
1217
+ ],
1218
+ "returns": null,
1219
+ "example": "/*\n * @param {Object} items - набор пар {variant_id: quantity, ...}. Если quantity = 0, то позиция удаляется из корзины, в противном случае устанавливается указанное кол-во\n * @param {Object} options - дополнительные поля: comments, coupon\n * @param {Object} options.comments - объект с комментариями вида {variant_id: comment, ...}\n * @param {String} options.coupon - название купона\n*/\n\nvar items = {\n 123456: 1,\n 123457: 3,\n 123450: 100\n};\n\nvar options = {\n comments: { 123456: 'Ваш комментарий' },\n coupon: 'test'\n}\n\najaxAPI.cart.update(items, optins)\n .done(function (onDone) { console.log('onDone: ', onDone) })\n .fail(function (onFail) { console.log('onFail: ', onFail) });",
1220
+ "events": []
1221
+ },
1222
+ {
1223
+ "name": "get",
1224
+ "fullName": "ajaxAPI.get",
1225
+ "description": "Получение информации о посетителе сайта",
1226
+ "parameters": [],
1227
+ "returns": null,
1228
+ "example": "/*\n* Если пользователь залогинен, получим json с акутальной информацией о покупателе\n* { status: \"ok\", client: { // информация о покупателе }}\n*\n* В случае, если пользователь не залогинен, получим\n* { status: \"error\", message: \"Not authorized\", url: \"/client_account/session/new\" }\n*/\n\najaxAPI.shop.client.get()\n .done(function (onDone) { console.log('onDone: ', onDone) })\n .fail(function (onFail) { console.log('onFail: ', onFail) })",
1229
+ "events": []
1230
+ },
1231
+ {
1232
+ "name": "getList",
1233
+ "fullName": "ajaxAPI.getList",
1234
+ "description": "Получение информации о списке товаров",
1235
+ "parameters": [],
1236
+ "returns": null,
1237
+ "example": "ajaxAPI.product.getList([123456,123457,123458,123459])\n .done(function (onDone) {console.log('onDone: ', onDone) })\n .fail(function (onFail) {console.log('onFail: ', onFail) });",
1238
+ "events": []
1239
+ },
1240
+ {
1241
+ "name": "get",
1242
+ "fullName": "ajaxAPI.get",
1243
+ "description": "Получение информации о товаре",
1244
+ "parameters": [],
1245
+ "returns": null,
1246
+ "example": "ajaxAPI.product.get(123456)\n .done(function (onDone) {console.log('onDone: ', onDone) })\n .fail(function (onFail) {console.log('onFail: ', onFail) });",
1247
+ "events": []
1248
+ },
1249
+ {
1250
+ "name": "get",
1251
+ "fullName": "ajaxAPI.get",
1252
+ "description": "Получение информации о коллекции",
1253
+ "parameters": [
1254
+ {
1255
+ "name": "handle",
1256
+ "type": "string",
1257
+ "description": "пермалинк коллекции, объязателен."
1258
+ },
1259
+ {
1260
+ "name": "filter",
1261
+ "type": "Object",
1262
+ "description": "объект с выбранными параметрами для фильтрации"
1263
+ },
1264
+ {
1265
+ "name": "pager",
1266
+ "type": "Object",
1267
+ "description": "объект с настройками пагинации"
1268
+ },
1269
+ {
1270
+ "name": "pager",
1271
+ "type": "number",
1272
+ "description": ".page_size - размер разбивки на страницы"
1273
+ },
1274
+ {
1275
+ "name": "pager",
1276
+ "type": "number",
1277
+ "description": ".page - номер страницы, по которой получаем информацию"
1278
+ }
1279
+ ],
1280
+ "returns": null,
1281
+ "example": "/*\n* @param {string} handle - пермалинк коллекции, объязателен.\n* @param {Object} filter - объект с выбранными параметрами для фильтрации\n* @param {Object} pager - объект с настройками пагинации\n* @param {number} pager.page_size - размер разбивки на страницы\n* @param {number} pager.page - номер страницы, по которой получаем информацию\n*/\n\nvar filter = {\n price_min: 4000,\n price_max: 10000,\n characteristics: [ 18775928, 18775929 ]\n};\n\nvar pager = {\n page_size: 25,\n page: 2\n}\n\najaxAPI.collection.get('collection_handle', filter, pager)\n .done(function (onDone) { console.log('onDone: ', onDone) })\n .fail(function (onFail) { console.log('onFail: ', onFail) });",
1282
+ "events": []
1283
+ },
1284
+ {
1285
+ "name": "add",
1286
+ "fullName": "ajaxAPI.add",
1287
+ "description": "Добавление товара в сравнение",
1288
+ "parameters": [],
1289
+ "returns": null,
1290
+ "example": "ajaxAPI.compare.add(123456)\n .done(function (onDone) { console.log('onDone: ', onDone) })\n .fail(function (onFail) { console.log('onFail: ', onFail) });",
1291
+ "events": []
1292
+ },
1293
+ {
1294
+ "name": "remove",
1295
+ "fullName": "ajaxAPI.remove",
1296
+ "description": "Удаление товара из сравнения",
1297
+ "parameters": [],
1298
+ "returns": null,
1299
+ "example": "ajaxAPI.compare.remove(123456)\n .done(function (onDone) { console.log('onDone: ', onDone) })\n .fail(function (onFail) { console.log('onFail: ', onFail) });",
1300
+ "events": []
1301
+ },
1302
+ {
1303
+ "name": "get",
1304
+ "fullName": "ajaxAPI.get",
1305
+ "description": "Получение списка сравнения",
1306
+ "parameters": [],
1307
+ "returns": null,
1308
+ "example": "ajaxAPI.compare.get()\n .done(function (onDone) { console.log('onDone: ', onDone) })\n .fail(function (onFail) { console.log('onFail: ', onFail) });",
1309
+ "events": []
1310
+ }
1311
+ ],
1312
+ "attributes": [],
1313
+ "events": [],
1314
+ "examples": []
1315
+ },
1316
+ {
1317
+ "name": "Shop",
1318
+ "displayName": "Вспомогательные методы",
1319
+ "description": "",
1320
+ "methods": [
1321
+ {
1322
+ "name": "Shop.money.format",
1323
+ "fullName": "Shop.Shop.money.format",
1324
+ "description": "Форматирование входной строки к виду согласно настройкам в админ-панели",
1325
+ "parameters": [
1326
+ {
1327
+ "name": "amount",
1328
+ "type": "string|number",
1329
+ "description": "строка или число, которое надо отформатировать в валюту"
1330
+ }
1331
+ ],
1332
+ "returns": {
1333
+ "type": "string",
1334
+ "description": "Строка, содержащая результат форматирования"
1335
+ },
1336
+ "example": "/*\n* @param {string|number} amount - строка или число, которое надо отформатировать в валюту\n*\n* @return {string} Строка, содержащая результат форматирования\n*/\n\nShop.money.format(1234.00);\n// 1234 руб.",
1337
+ "events": []
1338
+ }
1339
+ ],
1340
+ "attributes": [],
1341
+ "events": [],
1342
+ "examples": []
1343
+ },
1344
+ {
1345
+ "name": "Template",
1346
+ "displayName": "Шаблонизатор",
1347
+ "description": "Компонент «Template» отвечает за хранение и получение шаблонов написанных на шаблонизаторе библиотеки Lodash.",
1348
+ "methods": [
1349
+ {
1350
+ "name": "load",
1351
+ "fullName": "Template.load",
1352
+ "description": "Загрузка нового шаблона в список",
1353
+ "parameters": [
1354
+ {
1355
+ "name": "template_body",
1356
+ "type": "string",
1357
+ "description": "верстка шаблона"
1358
+ },
1359
+ {
1360
+ "name": "template_id",
1361
+ "type": "string",
1362
+ "description": "название шаблона"
1363
+ }
1364
+ ],
1365
+ "returns": null,
1366
+ "example": "/**\n* @param {string} template_body - верстка шаблона\n* @param {string} template_id - название шаблона\n */\nTemplate.load('<button class=\"button button--click_me\"><%= title %></button>', 'test-button')",
1367
+ "events": []
1368
+ },
1369
+ {
1370
+ "name": "render",
1371
+ "fullName": "Template.render",
1372
+ "description": "Загрузка нового шаблона в список",
1373
+ "parameters": [
1374
+ {
1375
+ "name": "templateData",
1376
+ "type": "Object",
1377
+ "description": "информация для шаблонизатора"
1378
+ },
1379
+ {
1380
+ "name": "template_id",
1381
+ "type": "string",
1382
+ "description": "название шаблона"
1383
+ }
1384
+ ],
1385
+ "returns": null,
1386
+ "example": "/**\n* @param {Object} templateData - информация для шаблонизатора\n* @param {string} template_id - название шаблона\n */\n$(targetNode).html(Template.render({ title: 'Click me!' }, 'test-button' ));",
1387
+ "events": []
1388
+ }
1389
+ ],
1390
+ "attributes": [],
1391
+ "events": [],
1392
+ "examples": []
1393
+ }
1394
+ ],
1395
+ "meta": {
1396
+ "modulesCount": 10,
1397
+ "methodsCount": 43,
1398
+ "attributesCount": 35,
1399
+ "eventsCount": 39,
1400
+ "globalObjectsCount": 14,
1401
+ "categoriesCount": 8
1402
+ }
1403
+ }