iwgt 2.4.12 → 2.4.13

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.
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "version": "2.0",
3
- "generatedAt": "2025-10-22T12:01:25.425Z",
3
+ "generatedAt": "2025-10-28T10:35:36.507Z",
4
4
  "description": "Справочник по библиотеке common.v2.js для InSales - набор готовых скриптов для разработки шаблонов",
5
5
  "installation": {
6
6
  "method": "liquid_tag",
@@ -340,13 +340,6 @@
340
340
  "wrong_code": "import $ from 'jquery';\nimport { Cart } from 'commonjs';",
341
341
  "correct_code": "// Все уже глобально доступно!\n$widget.each(function() {\n Cart.add({ variant_id: 123 });\n});"
342
342
  },
343
- {
344
- "id": "return_outside_function",
345
- "title": "Использование return вне функции",
346
- "description": "return в глобальной области видимости",
347
- "wrong_code": "if ($widget.length === 0) return; // SyntaxError: Illegal return statement",
348
- "correct_code": "if ($widget.length === 0) {\n console.warn('Виджет не найден');\n} else {\n $widget.each(function(index, widget) {\n // Код виджета...\n });\n}\n\n// АЛЬТЕРНАТИВА - обертка в IIFE\n(function() {\n if ($widget.length === 0) return; // ✅ Теперь можно\n \n $widget.each(function(index, widget) {\n // Код виджета...\n });\n})();"
349
- },
350
343
  {
351
344
  "id": "forgot_mobile",
352
345
  "title": "Забыли про мобильные",
@@ -372,12 +365,6 @@
372
365
  "description": "Проверка существования элементов перед их использованием",
373
366
  "code": "$widget.each(function(index, widget) {\n var $thisWidget = $(widget);\n var $button = $thisWidget.find('.my-widget__button');\n \n if ($button.length === 0) {\n console.warn('Кнопка не найдена!');\n return; // ✅ ПРАВИЛЬНО - внутри функции\n }\n \n $button.on('click', function() {\n console.log('Клик по кнопке');\n });\n});"
374
367
  },
375
- {
376
- "id": "check_widgets",
377
- "title": "Проверка наличия виджетов на странице",
378
- "description": "Проверка существования виджетов перед инициализацией",
379
- "code": "// ❌ НЕПРАВИЛЬНО - return вне функции\nif ($widget.length === 0) return; // SyntaxError!\n\n// ✅ ПРАВИЛЬНО - проверка с ранним выходом\nif ($widget.length === 0) {\n console.warn('Виджет не найден на странице');\n} else {\n $widget.each(function(index, widget) {\n var $thisWidget = $(widget);\n // Код виджета...\n });\n}\n\n// ✅ АЛЬТЕРНАТИВА - обертка в функцию\n(function() {\n if ($widget.length === 0) return; // ✅ Теперь можно использовать return\n \n $widget.each(function(index, widget) {\n var $thisWidget = $(widget);\n // Код виджета...\n });\n})();"
380
- },
381
368
  {
382
369
  "id": "check_events",
383
370
  "title": "Проверка событий CommonJS",
@@ -4,7 +4,7 @@
4
4
  "description": "Liquid фильтры InSales",
5
5
  "totalCategories": 7,
6
6
  "totalFilters": 53,
7
- "generatedAt": "2025-10-22T12:01:25.413Z"
7
+ "generatedAt": "2025-10-28T10:35:36.491Z"
8
8
  },
9
9
  "categories": [
10
10
  {
@@ -4,7 +4,7 @@
4
4
  "description": "Liquid переменные InSales",
5
5
  "totalCategories": 19,
6
6
  "totalVariables": 436,
7
- "generatedAt": "2025-10-22T12:01:25.250Z"
7
+ "generatedAt": "2025-10-28T10:35:36.283Z"
8
8
  },
9
9
  "categories": [
10
10
  {