PluginProbe
Ultimate Store Kit – Store Builder Addons for Elementor, WooCommerce Store Builder, EDD Store Builder / 2.0.4
Ultimate Store Kit – Store Builder Addons for Elementor, WooCommerce Store Builder, EDD Store Builder v2.0.4
3.1.4 3.0.8 3.0.9 3.1.0 3.1.2 3.1.3 3.0.7 3.0.5 3.0.4 3.0.3 3.0.2 trunk 1.5.0 1.5.1 1.5.2 1.6.1 1.6.2 1.6.3 1.6.4 2.0.0 2.0.1 2.0.2 2.0.3 2.0.4 2.0.5 All 93 releases
ultimate-store-kit / dci / assets / js / dci.js

dci.js in Ultimate Store Kit – Store Builder Addons for Elementor, WooCommerce Store Builder, EDD Store Builder 2.0.4, at dci/assets/js/dci.js

158 lines 4.2 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 (function ($) {
2 $(document).ready(function () {
3 // console.info("dci sdk.js loaded");
4
5 $(document).on(
6 "click",
7 ".dci-button-allow, .dci-button-skip, .dci-button-disallow",
8 function () {
9 let nonce = $(this)
10 .closest(".dci-notice-data")
11 .find("[name='nonce']")
12 .val(),
13 dci_name = $(this)
14 .closest(".dci-notice-data")
15 .find("[name='dci_name']")
16 .val(),
17 date_name = $(this)
18 .closest(".dci-notice-data")
19 .find("[name='dci_date_name']")
20 .val(),
21 allow_name = $(this)
22 .closest(".dci-notice-data")
23 .find("[name='dci_allow_name']")
24 .val();
25
26 $.ajax({
27 url: ajaxurl,
28 type: "POST",
29 data: {
30 action: "dci_sdk_insights",
31 button_val: this.value,
32 nonce: nonce,
33 dci_name: dci_name,
34 date_name: date_name,
35 allow_name: allow_name,
36 },
37 success: function (response) {
38 console.log(response);
39 if (response.status == "success") {
40 location.reload();
41 } else {
42 alert(response.message);
43 }
44 },
45 });
46 }
47 );
48
49 $(document).on("click", ".dci-global-notice .notice-dismiss", function () {
50 let nonce = $(this)
51 .closest(".dci-notice-data")
52 .find("[name='nonce']")
53 .val(),
54 dci_name = $(this)
55 .closest(".dci-notice-data")
56 .find("[name='dci_name']")
57 .val();
58
59 $.ajax({
60 url: ajaxurl,
61 type: "POST",
62 data: {
63 action: "dci_sdk_dismiss_notice",
64 nonce: nonce,
65 dci_name: dci_name,
66 },
67 });
68 });
69
70 /**
71 * If find .dci-feedback-wrapper then add class on the same id of the feedback
72 */
73 if ($(".dci-feedback-wrapper").length) {
74 $(".dci-feedback-wrapper").each(function () {
75 let feedback_id = $(this).attr("id");
76 $("#deactivate-" + feedback_id).addClass(
77 "dci-feedback-deactivate-plugin-btn"
78 );
79 });
80 }
81
82 $(document).on(
83 "click",
84 ".dci-feedback-deactivate-plugin-btn",
85 function (e) {
86 e.preventDefault();
87 let id = $(this).attr("id");
88
89 $("#" + id.replace("deactivate-", "")).show();
90 }
91 );
92
93 $(document).on("click", ".dci-feedback-submit-btn", function () {
94 let $noticeData = $(this).closest(".dci-notice-data");
95
96 let nonce = $noticeData.find("[name='nonce']").val(),
97 dci_name = $noticeData.find("[name='dci_name']").val(),
98 product_id = $noticeData.find("[name='product_id']").val(),
99 public_key = $noticeData.find("[name='public_key']").val(),
100 api_endpoint = $noticeData.find("[name='api_endpoint']").val(),
101 deactivate_url = $(this).data("deactivate-url");
102
103 let feedback_data = {};
104
105 $noticeData.find("textarea, input[type='checkbox']").each(function () {
106 const $input = $(this);
107 const name = $input.attr("name");
108 let value = $input.val();
109
110 if ($input.attr("type") === "checkbox") {
111 value = $input.is(":checked") ? "yes" : "no";
112 }
113
114 if (value !== "no" && value !== "") {
115 feedback_data[name] = value;
116 }
117 });
118
119 if (Object.keys(feedback_data).length === 0) {
120 feedback_data["no_feedback"] = "yes";
121 }
122
123 $.ajax({
124 url: ajaxurl,
125 type: "POST",
126 data: {
127 action: "dci_sdk_insights_deactivate_feedback",
128 nonce: nonce,
129 product_id: product_id,
130 public_key: public_key,
131 api_endpoint: api_endpoint,
132 feedback: JSON.stringify(feedback_data),
133 },
134 success: function (response) {
135 window.location.href = deactivate_url;
136 },
137 });
138 });
139
140 /**
141 * Button Color
142 */
143 window.CSS.registerProperty({
144 name: "--primaryColor",
145 syntax: "<color>",
146 inherits: false,
147 initialValue: "#AA00FF",
148 });
149
150 window.CSS.registerProperty({
151 name: "--secondaryColor",
152 syntax: "<color>",
153 inherits: false,
154 initialValue: "#FF2661",
155 });
156 });
157 })(jQuery);
158