Produced by Araxis Merge on 2023-07-12 04:42:41 +0000. See www.araxis.com for information about Merge. This report uses XHTML and CSS2, and is best viewed with a modern standards-compliant browser. For optimum results when printing this report, use landscape orientation and enable printing of background images and colours in your browser.
| # | Location | File | Last Modified |
|---|---|---|---|
| 1 | 2023-07-12 04:42:41 +0000 | ||
| 2 | Porto v4.0.6/Theme Files/Porto Theme/app/code/Smartwave/Filterproducts/view/adminhtml/web/js/content-type/filterproducts | preview.js | 2023-06-29 06:11:23 +0000 |
| Description | Between Files 1 and 2 | |
|---|---|---|
| Text Blocks | Lines | |
| Unchanged | 0 | 0 |
| Changed | 0 | 0 |
| Inserted | 1 | 161 |
| Removed | 0 | 0 |
| Whitespace | Consecutive whitespace is treated as a single space |
|---|---|
| Character case | Differences in character case are significant |
| Line endings | Differences in line endings (CR and LF characters) are ignored |
| CR/LF characters | Not shown in the comparison detail |
| Active line-pairing rules |
No regular expressions were active.
| 1 | /*eslint-disable */ | |||||
| 2 | /* jscs:disable */ | |||||
| 3 | ||||||
| 4 | function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _setPrototypeOf(subClass, superClass); } | |||||
| 5 | ||||||
| 6 | function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } | |||||
| 7 | ||||||
| 8 | define(["jquery", "knockout", "mage/translate", "Magento_PageBuilder/js/events", "underscore", "Magento_PageBuilder/js/config", "Magento_PageBuilder/js/content-type-menu/hide-show-option", "Magento_PageBuilder/js/content-type/preview"], function (_jquery, _knockout, _translate, _events, _underscore, _config, _hideShowOption, _preview) { | |||||
| 9 | /** | |||||
| 10 | * Copyright © Magento, Inc. All rights reserved. | |||||
| 11 | * See COPYING.txt for license details. | |||||
| 12 | */ | |||||
| 13 | ||||||
| 14 | /** | |||||
| 15 | * @api | |||||
| 16 | */ | |||||
| 17 | var Preview = /*#__PURE__*/function (_preview2) { | |||||
| 18 | "use strict"; | |||||
| 19 | ||||||
| 20 | _inheritsLoose(Preview, _preview2); | |||||
| 21 | ||||||
| 22 | /** | |||||
| 23 | * Define keys which when changed should not trigger the slider to be rebuilt | |||||
| 24 | * | |||||
| 25 | * @type {string[]} | |||||
| 26 | */ | |||||
| 27 | ||||||
| 28 | /** | |||||
| 29 | * @inheritdoc | |||||
| 30 | */ | |||||
| 31 | function Preview(contentType, config, observableUpdater) { | |||||
| 32 | var _this; | |||||
| 33 | ||||||
| 34 | _this = _preview2.call(this, contentType, config, observableUpdater) || this; | |||||
| 35 | _this.displayPreview = _knockout.observable(false); | |||||
| 36 | _this.previewElement = _jquery.Deferred(); | |||||
| 37 | _this.widgetUnsanitizedHtml = _knockout.observable(); | |||||
| 38 | _this.slidesToShow = 5; | |||||
| 39 | _this.productItemSelector = ".product-item"; | |||||
| 40 | _this.centerModeClass = "center-mode"; | |||||
| 41 | _this.messages = { | |||||
| 42 | EMPTY: (0, _translate)("Empty Products"), | |||||
| 43 | NO_RESULTS: (0, _translate)("No products were found matching your condition"), | |||||
| 44 | LOADING: (0, _translate)("Loading..."), | |||||
| 45 | UNKNOWN_ERROR: (0, _translate)("An unknown error occurred. Please try again.") | |||||
| 46 | }; | |||||
| 47 | _this.ignoredKeysForBuild = ["margins_and_padding", "border", "border_color", "border_radius", "border_width", "css_classes", "text_align"]; | |||||
| 48 | _this.placeholderText = _knockout.observable(_this.messages.EMPTY); // Redraw slider after content type gets redrawn | |||||
| 49 | _events.on("contentType:redrawAfter", function (args) { | |||||
| 50 | if (_this.element && _this.element.children) { | |||||
| 51 | var $element = (0, _jquery)(_this.element.children); | |||||
| 52 | } | |||||
| 53 | }); | |||||
| 54 | ||||||
| 55 | return _this; | |||||
| 56 | } | |||||
| 57 | /** | |||||
| 58 | * Return an array of options | |||||
| 59 | * | |||||
| 60 | * @returns {OptionsInterface} | |||||
| 61 | */ | |||||
| 62 | ||||||
| 63 | ||||||
| 64 | var _proto = Preview.prototype; | |||||
| 65 | ||||||
| 66 | _proto.retrieveOptions = function retrieveOptions() { | |||||
| 67 | var options = _preview2.prototype.retrieveOptions.call(this); | |||||
| 68 | ||||||
| 69 | options.hideShow = new _hideShowOption({ | |||||
| 70 | preview: this, | |||||
| 71 | icon: _hideShowOption.showIcon, | |||||
| 72 | title: _hideShowOption.showText, | |||||
| 73 | action: this.onOptionVisibilityToggle, | |||||
| 74 | classes: ["hide-show-content-type"], | |||||
| 75 | sort: 40 | |||||
| 76 | }); | |||||
| 77 | return options; | |||||
| 78 | } | |||||
| 79 | /** | |||||
| 80 | * On afterRender callback. | |||||
| 81 | * | |||||
| 82 | * @param {Element} element | |||||
| 83 | */ | |||||
| 84 | ; | |||||
| 85 | ||||||
| 86 | _proto.onAfterRender = function onAfterRender(element) { | |||||
| 87 | this.element = element; | |||||
| 88 | this.previewElement.resolve(element); | |||||
| 89 | } | |||||
| 90 | /** | |||||
| 91 | * @inheritdoc | |||||
| 92 | */ | |||||
| 93 | ; | |||||
| 94 | ||||||
| 95 | _proto.afterObservablesUpdated = function afterObservablesUpdated() { | |||||
| 96 | var _this2 = this; | |||||
| 97 | ||||||
| 98 | _preview2.prototype.afterObservablesUpdated.call(this); | |||||
| 99 | ||||||
| 100 | var data = this.contentType.dataStore.getState(); | |||||
| 101 | ||||||
| 102 | if (this.hasDataChanged(this.previousData, data)) { | |||||
| 103 | this.displayPreview(false); | |||||
| 104 | ||||||
| 105 | ||||||
| 106 | var url = _config.getConfig("preview_url"); | |||||
| 107 | var requestConfig = { | |||||
| 108 | // Prevent caching | |||||
| 109 | method: "POST", | |||||
| 110 | data: { | |||||
| 111 | role: this.config.name, | |||||
| 112 | directive: this.data.main.html() | |||||
| 113 | } | |||||
| 114 | }; | |||||
| 115 | this.placeholderText(this.messages.LOADING); | |||||
| 116 | _jquery.ajax(url, requestConfig).done(function (response) { | |||||
| 117 | if (typeof response.data !== "object" || !Boolean(response.data.content)) { | |||||
| 118 | _this2.placeholderText(_this2.messages.NO_RESULTS); | |||||
| 119 | ||||||
| 120 | return; | |||||
| 121 | } | |||||
| 122 | ||||||
| 123 | if (response.data.error) { | |||||
| 124 | _this2.widgetUnsanitizedHtml(response.data.error); | |||||
| 125 | } else { | |||||
| 126 | _this2.widgetUnsanitizedHtml(response.data.content); | |||||
| 127 | ||||||
| 128 | _this2.displayPreview(true); | |||||
| 129 | } | |||||
| 130 | ||||||
| 131 | _this2.previewElement.done(function () { | |||||
| 132 | (0, _jquery)(_this2.element).trigger("contentUpdated"); | |||||
| 133 | }); | |||||
| 134 | }).fail(function () { | |||||
| 135 | _this2.placeholderText(_this2.messages.UNKNOWN_ERROR); | |||||
| 136 | }); | |||||
| 137 | } | |||||
| 138 | ||||||
| 139 | this.previousData = Object.assign({}, data); | |||||
| 140 | }; | |||||
| 141 | /** | |||||
| 142 | * Determine if the data has changed, whilst ignoring certain keys which don't require a rebuild | |||||
| 143 | * | |||||
| 144 | * @param {DataObject} previousData | |||||
| 145 | * @param {DataObject} newData | |||||
| 146 | * @returns {boolean} | |||||
| 147 | */ | |||||
| 148 | ; | |||||
| 149 | ||||||
| 150 | _proto.hasDataChanged = function hasDataChanged(previousData, newData) { | |||||
| 151 | previousData = _underscore.omit(previousData, this.ignoredKeysForBuild); | |||||
| 152 | newData = _underscore.omit(newData, this.ignoredKeysForBuild); | |||||
| 153 | return !_underscore.isEqual(previousData, newData); | |||||
| 154 | }; | |||||
| 155 | ||||||
| 156 | return Preview; | |||||
| 157 | }(_preview); | |||||
| 158 | ||||||
| 159 | return Preview; | |||||
| 160 | }); | |||||
| 161 | //# sourceMappingURL=preview.js.map |
Araxis Merge (but not the data content of this report) is Copyright © 1993–2019 Araxis Ltd (www.araxis.com). All rights reserved.