PageSourceSearch

https://www.bug.co.il/lib/customers-club/customers-club.js?v=20260324

js bug.co.il collected 2026-10-02 05:51:12 UTC 42,791 bytes, 701 lines download raw bytes

1
2; (function ($) {
3
4    'use strict';
5
6    var defaults = {
7        properties: undefined,
8        lists: {
9            genders: "/elements/list_3.json",
10            interests: "/elements/list_1.json",
11            customers_type: "/elements/list_2.json"
12        },
13        recaptcha_site_key: "6LcSVS4nAAAAAL5eWjXxHh0YizgajIk0QaJSWrpB",
14        independent_form: true,
15        button_text: undefined,
16        update_url: undefined,
17        success_callback: undefined,
18        do_not_send_to_link_after_registration_success:undefined
19    };
20
21    $.fn.customersClub = function (options) {
22
23        if (this.length === 0) {
24            return this;
25        }
26        else if (this.length > 1) {
27            this.each(function () { $(this).customersClub(options) });
28            return this;
29        }
30
31        var plugin = {};
32        var ec = {};
33        var elem = this;
34        plugin.elem = this;
35        plugin.namespace = "customers_club_";
36        plugin.settings = $.extend(true, {}, defaults, options);
37
38
39        var input_error_handler = function (elem, validity, error_message, focus) {
40            if (typeof (focus) === "undefined") {
41                focus = true;
42            }
43            var parent = $(elem).parent();
44            if (validity) {
45                //$(parent).find(".input-error-message").remove();
46                //$(elem).removeClass("error");
47
48            }
49            else {
50
51                if (typeof (elem.length) === "number") { //jquery array or html select
52                    if (elem[0].nodeName !== "OPTION") { //not html select
53                        elem = elem[0];
54                    }
55                }
56
57                elem.setCustomValidity(error_message);
58                elem.reportValidity();
59
60                var event = new CustomEvent('custom_elem_report_validity_showed_up', {
61                    detail: {
62                        elem: elem,
63                        error_message:error_message
64                    },
65                    bubbles: true
66                });
67
68                $(elem)[0].dispatchEvent(event);
69
70                $(elem).one("click focus blur input", function () {
71                    this.setCustomValidity("");
72                });
73                 
74
75                //var message = $(parent).find(".input-error-message");
76                //if ($(message).length == 0) {
77                //    message = $("<small/>").addClass("input-error-message").appendTo(parent);
78                //}
79                //$(message).text(error_message);
80                //$(elem).addClass("error");
81                //if (focus) {
82                //    //$(elem).focus();
83                //}
84                //$(parent).find(".input-success-message").remove();
85            }
86        }
87
88        var form_error_handler = function (error_message) {
89            //createModal(error_message,null, null, "","form_error", true);
90            $(plugin.elem.form_error).text(error_message);
91            var triggered = false;
92            var triggeredElem = null;
93            $(plugin.elem.form).find(".form-row input,.form-row select,.mfa-code").each(function () {
94                if (!this.checkValidity()) {
95                    if (!triggered) {
96                        input_error_handler(this, false, $(this).attr("data-instructor-message"), false);
97                        triggered = true;
98                        triggeredElem = this;
99                    }
100                }
101                else {
102                    input_error_handler(this, true);
103                }
104            });
105            //var error = $(plugin.elem.form).find(".input-error-message").first();
106            if (triggeredElem != null) {
107                console.log(triggeredElem);
108                console.log($(plugin.elem.form).offset().top);
109                console.log($(triggeredElem).offset().top);
110                $("html,body").animate({ scrollTop: Math.max(0, $(triggeredElem).offset().top - $(plugin.elem.form).offset().top) }, 500);
111            }
112        }
113
114        var input_success_handler = function (elem, validity, success_message) {
115            var parent = $(elem).closest(".form-row");
116            if (!validity) {
117                $(parent).find(".input-success-message").remove();
118            }
119            else {
120                var message = $(parent).find(".input-success-message");
121                if ($(message).length == 0) {
122                    message = $("<small/>").addClass("input-success-message").appendTo(parent);
123                }
124                $(message).text(success_message);
125                $(parent).find(".input-error-message").remove();
126            }
127        }
128
129        var append_property = function (name, text, type, property, pattern, message, options_url, min, max) {
130
131            var id = [name, plugin.id].join("");
132            var input;
133            const disabled = typeof (property.disabled) !== "undefined" && property.disabled === true ? "disabled" : "";
134            const required = typeof (property.required) !== "undefined" && property.required === true ? "required" : "";
135            const readonly = typeof (property.readonly) !== "undefined" && property.readonly === true ? "readonly" : "";
136            if (type === "select") {
137                input = $("<select/>");
138                if (typeof (options_url) !== "undefined") {
139                    $("<option/>").val("").text("").appendTo(input);
140                    $.getJSON(options_url, function (options) {
141                        options.forEach(option => {
142                            $("<option/>").val(option.id).text(option.name).appendTo(input);
143                        });
144                        if (typeof (property.default_value) !== "undefined" && property.default_value.trim() != "") {
145                            $(input).val(property.default_value);
146                        }
147                    });
148                }
149            }
150            else if (type === "auto-complete") {
151                input = $("<input/>").prop("type", "text");
152                if (typeof (property.default_value) !== "undefined" && property.default_value.trim() != "") {
153                    $(input).val(property.default_value);
154                }
155            }
156            else if (type === "checkboxes") {
157                var grouped = $("<div/>").addClass("grouped-input-container").addClass(["checkboxes_",name,"_container"].join(""));//!!
158                input = grouped;
159                if (typeof (options_url) !== "undefined") {
160                    $.getJSON(options_url, function (options) {
161                        options.forEach(option => {
162                            var option_id = [id, create_guid()].join("");
163                            $("<div/>").addClass("grouped-checkbox-container").prop("tabindex","0").append(
164                                $("<input/>").prop("type", "checkbox").val(option.id).prop("id", option_id).prop("name", name)
165                            ).append(
166                                $("<label/>").prop("for", option_id).text(option.name)
167                            ).appendTo(grouped);
168                        });
169                        if (typeof (property.default_value) !== "undefined" && property.default_value.length > 0) {
170                            property.default_value.forEach(x => {
171                                $(grouped).find("input[type='checkbox'][name='" + name + "'][value='" + x + "']").prop("checked", "checked");
172                            });
173                        }
174                    });
175                }
176            }
177            else if (type === "date") {
178                input = $("<div/>").addClass("input-container");
179                ////const guid = create_guid();
180                ////bug_global.ref[guid] =
181                let date_default_value_year, date_default_value_month, date_default_value_day;
182                //input = $("<input/>").prop("type", "text");//.prop("readonly", "readonly");
183                if (!property.disabled && readonly !== "readonly") {
184                    const date = new Date();
185                    const dStartD = new Date(date.getFullYear() - 120, date.getMonth(), date.getDate(), 0, 0, 0);
186                    const dEndD = new Date(date.getFullYear() - 18, date.getMonth(), date.getDate(), 0, 0, 0);
187                    let defaultDate = null;
188                    if (typeof (property.default_value) !== "undefined" && property.default_value.trim() != "") {
189                        const arr = property.default_value.split("-");
190                        date_default_value_year = arr[0];
191                        date_default_value_month = arr[1];
192                        date_default_value_day = arr[2];
193                        defaultDate = new Date(arr[0], arr[1], arr[2]);
194                        //$(input).val(property.default_value);
195                    }
196                    else {
197                        defaultDate = dEndD;
198                    }
199                    init_ec_datetime(input, !property.disabled, undefined,date_default_value_year, date_default_value_month, date_default_value_day,
200                        name, new Date().getFullYear() - 120, new Date().getFullYear() - 18, property.required, "יש להזין תאריך לידה (ההרשמה מגיל 18 ומעלה)",
201                        false, undefined,
202                        undefined, undefined, undefined, undefined);
203                //    ////$(input).attr("data-global-id", guid);
204                //    console.log("selectedDate=");
205                //    console.log(defaultDate);
206                //    const func = function () {
207                //        $(input).AnyPicker({
208                //            mode: "datetime",
209                //            dateTimeFormat: "dd/MM/yyyy",
210                //            rowsNavigation: "scroller+buttons",
211                //            minValue: dStartD,
212                //            maxValue: dEndD,
213                //            selectedDate: defaultDate,
214                //            i18n: {
215                //                headerTitle: "בחירת תאריך",
216                //                setButton: "אישור",
217                //                clearButton: "איפוס",
218                //                cancelButton: "ביטול",
219                //                days: ["א", "ב", "ג", "ד", "ה", "ו", "ש"],
220                //                months: ["ינואר", "פברואר", "מרץ", "אפריל", "מאי", "יוני",
221                //                    "יולי", "אוגוסט", "ספטמבר", "אוקטובר", "נובמבר", "דצמבר"],
222                //                shortMonths: ["ינו", "פבר", "מרץ", "אפר", "מאי", "יונ",
223                //                    "יול", "אוג", "ספט", "אוק", "נוב", "דצ"]
224                //            }, onInit: function () {
225                //                console.log(this);
226                //                //$(input).val("");
227                //            },
228                //            "rtl": true,
229                //            //hAlign: "right",
230                //            headerTitle: {
231                //                contentBehaviour: "Dynamic",
232                //                format: "dd/MM/yyyy",
233                //                markup: "<span class='ap-header__title'>בחירת תאריך</span>",
234                //                type: "Text"
235                //            }
236                //        });
237                //    }
238                //    if (typeof ($.fn.AnyPicker) == "undefined") {
239                //        $.get('/lib/nehakadam-AnyPicker-b59ef38/dist/anypicker-all.min.css').done(function (data) {
240                //            $("<style></style>").text(data).appendTo('head');
241                //            $.getScript("/lib/nehakadam-AnyPicker-b59ef38/dist/anypicker.min.js", function () {
242                //                $.getScript("/lib/nehakadam-AnyPicker-b59ef38/dist/i18n/anypicker-i18n.js", func);
243                //            });
244                //        });
245                //    }
246                //    else {
247                //        func();
248                //    }
249                }
250                else {
251                    if (typeof (property.default_value) !== "undefined" && property.default_value.trim() != "") {
252                        const arr = property.default_value.split("-");
253						if ($(input)[0].tagName.toLowerCase() === 'div')
254							$(input).text([arr[2], arr[1], arr[0]].join("/"));
255						else
256							$(input).val([arr[2], arr[1], arr[0]].join("/"));
257                    }
258                }
259            }
260            else {
261                input = $("<input/>").prop("type", type);
262                if (typeof (property.default_value) !== "undefined") {
263                    if (type === "checkbox") {
264                        $(input)[0].checked = property.default_value;
265                    }
266                    else {
267                        $(input).val(property.default_value);
268                    }
269                }
270            }
271
272            if (type !== "checkboxes") {
273                $(input)
274                    .prop("id", id)
275                    .prop("name", name)
276                    .prop("disabled", disabled)
277                    .prop("readonly", readonly)
278                    .prop("required", required)
279                    .prop("pattern", pattern)
280                    .prop("min", min)
281                    .prop("max", max)
282                    .attr("data-instructor-message", message);
283            }
284
285            if (type === "auto-complete") {
286                var auto_complete_container = $("<div/>").addClass("input-container");
287                $("<input/>").prop("type", "hidden").prop("name", [name, "_id"].join("")).prop("id", [$(input).prop("id"), "_id"].join("")).appendTo(auto_complete_container);
288                $(input).appendTo(auto_complete_container);
289                input = auto_complete_container;
290            }
291            else if (type === "checkboxes") {
292                var checkboxes_container = $("<div/>").addClass("input-container");
293                $(input).appendTo(checkboxes_container);
294                input = checkboxes_container;
295            }
296
297            var form_row = $("<div/>").addClass("form-row").append(
298                $("<label/>").prop("for", id).html(text)
299            ).css("display", property.show ? undefined : "none")
300                .appendTo(plugin.elem.form);
301            if (type === "checkbox") {
302                $(form_row).addClass("checkbox-container").prepend(input);
303            }
304            else {
305                $(form_row).append(input);
306            }
307
308            if (typeof (property.required) !== "undefined" && property.required == true ? "required" : "") {
309                $(form_row).addClass("req");
310            }
311
312            if (name === "gender") {
313                ////const func = function () {
314                ////    $(input).DDLAsButtons({
315                ////        cssClass: "input-container"
316                ////    });
317                ////};
318                ////if (typeof ($.fn.DDLAsButtons) == "undefined") {
319                ////    $.getScript("/lib/ddl_as_buttons/ddlAsButtons.js?v=1", func);
320                ////}
321                ////else {
322                ////    func();
323                ////}
324                //const buttonsContainer = $("<div/>").addClass("ddlAsButtons_container").addClass("input-container").insertAfter(input);
325                //$(input).css("width", "0").css("height", "0").css("opacity", "0").children("option").each(function () {
326                //    const option = this;
327                //    if ($(option).val() !== "") {
328                //        option.ddlAsButton_button = $("<button/>").appendTo(buttonsContainer).text($(option).text()).on("click", function (e) {
329                //            e.preventDefault();
330                //            const selectedOption = $(input).children("option:selected");
331                //            if (typeof (selectedOption) !== "undefined" && selectedOption.length > 0 && selectedOption.val() !== "") {
332                //                selectedOption[0].ddlAsButton_button.removeClass("selected");
333                //            }
334                //            $(input).val($(option).val());
335                //            $(this).addClass("selected");
336                //        });
337                //        if ($(option).is(":selected")) {
338                //            $(option.ddlAsButton_button).trigger("click");
339                //        }
340                //    }
341                //});
342            }
343
344            return input;
345        }
346
347        var check_user_by_otp = function (otp_guid) {
348            //grecaptcha.ready(function () {
349            //    grecaptcha.execute(plugin.settings.recaptcha_site_key, { action: 'submit' }).then(function (token) {
350                    $.post("/check-exists-user-by-otp", { cc_otp_guid: otp_guid/*, recaptcha_token: token*/ }).done(function (data) {
351                        if (data.status) {
352                            if (data.first_name !== "" && $(plugin.first_name_input).val() === "") {
353                                $(plugin.first_name_input).val(data.first_name);
354                            }
355                            if (data.last_name !== "" && $(plugin.last_name_input).val() === "") {
356                                $(plugin.last_name_input).val(data.last_name);
357                            }
358                            if (data.email !== "" && $(plugin.email_input).val() === "") {
359                                $(plugin.email_input).val(data.email).focus().one("blur", function () {
360                                    $(plugin.email_input).trigger("change");
361                                });
362                            }
363                            if (data.city_id != null && !isNaN(data.city_id) && $(plugin.city_input).val() === "") {
364                                $(plugin.city_id_input).val(data.city_id);
365                                $(plugin.city_input).val(data.city_name);
366                            }
367                            if (data.connect_to_website_customer_id != null && data.connect_to_website_customer_id == true) {
368                                if ($(plugin.connect_to_website_customer_id_input).is(":hidden")) {
369                                    //אם כבר מוצג זה אומר שבדיקה קודמת על ידי היוזר הפעילה והיוזר כיבה, כלומר האפשרות כרגע מוצגת ואין להפוך את הבחירה של היוזר
370                                    $(plugin.connect_to_website_customer_id_input).prop("checked", "checked").closest(".form-row").show();
371                                }
372                            }
373                            else {
374                                if ($(plugin.connect_to_website_customer_id_input).is(":hidden")) {
375                                    //כנל אם מוצג - בדיקה אחרת פתחה אותו, ואין לשנות את בחירתה
376                                    $(plugin.connect_to_website_customer_id_input).prop("checked", "").closest(".form-row").hide();
377                                }
378                            }
379                        }
380                        else {
381                            if (typeof (data.is_user_already_exists) !== "undefined" && data.is_user_already_exists == true) {
382                                if (data.type === "cellphone") {
383                                    blockPage();
384                                    input_success_handler(plugin.cellphone_input, "לקוח קיים, מיד תועבר...");
385                                    window.location = ["/cc/", data.otp_id].join("");//עדכון פרטים
386                                    //$(plugin.cellphone_input).val("").prop("readonly","").prop("disabled","");
387                                    //input_error_handler(plugin.cellphone_input, false, data.message);
388                                } else if (data.type === "email") {
389                                    $(plugin.email_input).val("").prop("readonly","").prop("disabled","");
390                                    input_error_handler(plugin.email_input, false, data.message);
391                                }
392                            }
393                        }
394                    });
395            //    });
396            //});
397        }
398
399        plugin.elem.get_data = function () {
400
401            var form_data = $(plugin.elem.form).serialize();
402            var urlparams = new URLSearchParams(form_data);
403
404            if (urlparams.get("cellphone_otp_id") == "") {
405                input_error_handler(cc_cellphone, false, "יש לאמת את מספר הטלפון הנייד");
406                form_error_handler("קיימות שגיאות בטופס");
407                return null;
408            }
409            else {
410                const birth_date_day = $(plugin.elem.form).find("input[name='birth_date_day']");
411                const birth_date_container = $(birth_date_day).closest(".ec_dttm_container");
412                const global_ref_key = $(birth_date_container).attr("data-global-ref-key");
413                const ec_birth_date = bug_global.ref[global_ref_key];
414				if (typeof(ec_birth_date) !== "undefined"){
415					const ec_birth_date_value = ec_birth_date.get_value();
416					if (!ec_birth_date_value.date.is_valid) {
417						input_error_handler(birth_date_day, false, ec_birth_date_value.date.description);
418						form_error_handler("קיימות שגיאות בטופס");
419						return null;
420					}
421					urlparams.set("birth_date", ec_birth_date_value.date.value);
422				}
423                
424
425                if (typeof (plugin.policy_confirmation_input) !== "undefined" && $(plugin.policy_confirmation_input).length > 0) {
426                    urlparams.set("policy_confirmation", $(plugin.policy_confirmation_input)[0].checked);
427                }
428                if (typeof (plugin.mailing_confirmation_input) !== "undefined" && $(plugin.mailing_confirmation_input).length > 0) {
429                    urlparams.set("mailing_confirmation", $(plugin.mailing_confirmation_input)[0].checked);
430                }
431                if (typeof (plugin.push_confirmation_input) !== "undefined" && $(plugin.push_confirmation_input).length > 0) {
432                    urlparams.set("push_confirmation", $(plugin.push_confirmation_input)[0].checked);
433                }
434                if (typeof (plugin.interest_input) !== "undefined" && $(plugin.interest_input).length > 0) {
435                    var interests = [];
436                    $(plugin.interest_input).find("input[name='interests']:checked").each(function () {
437                        interests.push($(this).val());
438                    });
439                    urlparams.set("interests", interests.join(","));
440                }
441
442                return urlparams;
443            }
444
445        }
446
447        var init = function () {
448
449            $(plugin.elem).addClass([plugin.namespace, "container"].join(""));
450
451            plugin.id = create_guid();
452            plugin.elem.form = $(typeof (plugin.settings.independent_form) === "undefined" || plugin.settings.independent_form == true ? "<form/>" : "<div/>")
453                .prop("id", "customers_club_registration_form").appendTo(plugin.elem);
454
455            if (typeof (plugin.settings.properties) !== "undefined") {
456                if (typeof (plugin.settings.properties.card_code) !== "undefined") {
457                    plugin.card_code_input = append_property("card_code", "קוד לקוח", "text", plugin.settings.properties.card_code, undefined, undefined, undefined);
458                }
459                if (typeof (plugin.settings.properties.cellphone) !== "undefined") {
460                    var input = append_property("cellphone", "טלפון נייד", "tel", plugin.settings.properties.cellphone, "05\\d{8}", "יש להזין מספר טלפון נייד חוקי");
461                    plugin.cellphone_input = input;
462                    if (typeof (plugin.settings.properties.cellphone.otp) !== "undefined" && plugin.settings.properties.cellphone.otp.required == true) {
463                        if (typeof (plugin.settings.properties.cellphone.otp.id) !== "undefined") {
464                            $("<input/>").prop("type", "hidden").prop("name", "cellphone_otp_id").insertAfter(input).val(plugin.settings.properties.cellphone.otp.id);
465                            input_success_handler(input, true, "אומת בהצלחה");
466                            check_user_by_otp(plugin.settings.properties.cellphone.otp.id);
467                        }
468                        else {
469                            createOTP(input, "cellphone", undefined, undefined, undefined, function (data) {
470                                check_user_by_otp(data.otp_id);
471                            }, "inline", false);
472                        }
473                    }
474                }
475                if (typeof (plugin.settings.properties.first_name) !== "undefined") {
476                    plugin.first_name_input = append_property("first_name", "שם פרטי", "text", plugin.settings.properties.first_name, "[א-תA-Za-z0-9'\" ]+", "יש להזין שם פרטי");
477                }
478                if (typeof (plugin.settings.properties.last_name) !== "undefined") {
479                    plugin.last_name_input = append_property("last_name", "שם משפחה", "text", plugin.settings.properties.last_name, "[א-תA-Za-z0-9'\" ]+", "יש להזין שם משפחה");
480                }
481                if (typeof (plugin.settings.properties.email) !== "undefined") {
482                    plugin.email_input = append_property("email", "אימייל", "email", plugin.settings.properties.email, undefined, "יש להזין כתובת אימייל חוקית");
483                    var input = plugin.email_input;
484                    if (typeof (plugin.settings.properties.email.otp) !== "undefined" && plugin.settings.properties.email.otp.required == true) {
485                        if (typeof (plugin.settings.properties.email.otp.id) !== "undefined") {
486                            $("<input/>").prop("type", "hidden").prop("name", "otp_email_guid").insertAfter(input).val(plugin.settings.properties.email.otp.id);
487                            input_success_handler(input, true, "אומת בהצלחה");
488                            check_user_by_otp(plugin.settings.properties.email.otp.id);
489                        }
490                        else {
491                            createOTP(input, "email", undefined, plugin.settings.properties.email.otp.by_parameters, undefined, function (data) {
492                                check_user_by_otp(data.otp_id);
493                            }, "inline", false);
494                        }
495                    }
496                }
497                if (typeof (plugin.settings.properties.gender) !== "undefined") {
498                    plugin.gender_input =append_property("gender", "מגדר", "select", plugin.settings.properties.gender, undefined, "יש לבחור מגדר מהרשימה", typeof (plugin.settings.lists) !== "undefined" ? plugin.settings.lists.genders : undefined);
499                }
500                if (typeof (plugin.settings.properties.birth_date) !== "undefined") {
501                    var max = new Date();
502                    max.setFullYear(max.getFullYear() - 18);
503                    plugin.birth_date_input = append_property("birth_date", "תאריך לידה", "date", plugin.settings.properties.birth_date, undefined, "יש להזין תאריך לידה, הרישום מגיל 18", undefined, "1900-01-01", [max.getFullYear(), "-", (max.getMonth() + 1).toString().padStart(2, "0"), "-", max.getDate().toString().padStart(2, "0")].join(""));
504                }
505                if (typeof (plugin.settings.properties.city) !== "undefined") {
506                    //var required = plugin.settings.properties.city.required;
507                    //if (plugin.settings.properties.city.required) {
508                    //    plugin.settings.properties.city.required = false;
509                    //}
510                    var input = append_property("city", "עיר", "auto-complete", plugin.settings.properties.city, undefined, "יש לבחור עיר מהרשימה")
511                        .find("input[type='text']");
512                    plugin.city_input = input;
513                    //plugin.city_id_input = $(input).find("#" + $(input).find("input[name='city']").prop("id") + "_id");
514                    $(input).ecAutoComplete({
515                        source_arr_get_url_func: function () {
516                            return "/elements/ministryOfInteriorCities.json";
517                        },
518                        on_select: function (elem, id) {
519                            input_error_handler(plugin.city_input, true);
520                            //$(plugin.city_input).val(id).trigger("change");
521                            //$(plugin.city_id_input).val(id);
522                        },
523                        remove_when_not_from_list:true
524                    });
525                }
526                if (typeof (plugin.settings.properties.interests) !== "undefined") {
527                    plugin.interest_input =append_property("interests", "תחומי עניין", "checkboxes", plugin.settings.properties.interests, undefined, "", typeof (plugin.settings.lists) !== "undefined" ? plugin.settings.lists.interests : undefined);
528                }
529                if (typeof (plugin.settings.properties.customer_type) !== "undefined") {
530                    plugin.customer_type_input =append_property("type", "סוג לקוח", "select", plugin.settings.properties.customer_type, undefined, "יש לבחור סוג לקוח מהרשימה", typeof (plugin.settings.lists) !== "undefined" ? plugin.settings.lists.customers_type : undefined);
531                }
532                if (typeof (plugin.settings.properties.policy_confirmation) !== "undefined") {
533                    plugin.policy_confirmation_input = append_property("policy_confirmation", "<a href=\"#\" onclick=\"openPageAsPopup('/clubtakanon?popup=1'); return false;\">אני מאשר את התקנון</a>", "checkbox", plugin.settings.properties.policy_confirmation, undefined, "חובה לאשר את התקנון", undefined);
534                }
535                if (typeof (plugin.settings.properties.mailing_confirmation) !== "undefined") {
536                    plugin.mailing_confirmation_input = append_property("mailing_confirmation", "אני מאשר קבלת מידע אודות מבצעים והטבות לחברי מועדון", "checkbox", plugin.settings.properties.mailing_confirmation, undefined, "חובה לאשר קבלת דיוור", undefined);
537                }
538                if (typeof (plugin.settings.properties.push_confirmation) !== "undefined") {
539                    plugin.push_confirmation_input = append_property("push_confirmation", "אישור פוש", "checkbox", plugin.settings.properties.push_confirmation, undefined, undefined, undefined);
540                }
541
542                if (typeof (plugin.settings.properties.connect_to_website_customer_id) !== "undefined") {
543                    plugin.connect_to_website_customer_id_input = append_property("connect_to_website_customer_id", "המשתמש שלי באתר באג ישוייך לכרטיס שלי במועדון הלקוחות", "checkbox", plugin.settings.properties.connect_to_website_customer_id, undefined, undefined, undefined);
544                }
545
546                if (typeof (plugin.settings.independent_form) === "undefined" || plugin.settings.independent_form == true) {
547                    plugin.elem.form_error = $("<div/>").addClass("error-message").prop("tabindex","0").appendTo(plugin.elem.form);
548                    plugin.elem.submit_button = $("<button/>").prop("type", "button").addClass("button-design-1")
549                        .attr("data-back-text", plugin.settings.button_text).text(plugin.settings.button_text).insertBefore(plugin.elem.form_error).on("click", function (e) {
550                            e.preventDefault();
551                            $(plugin.elem.form_error).text("");
552                            $(this).find("input,select,.mfa-code").each(function () {
553                                input_error_handler(this, true);
554                            });
555                            if (plugin.elem.form[0].checkValidity()) {
556                                buttonInProgress(plugin.elem.submit_button,"הנתונים נשלחים...");
557                                $(plugin.elem.form_error).text("");
558
559                                //var form_data = $(plugin.elem.form).serialize();
560                                var urlparams = plugin.elem.get_data();// new URLSearchParams(form_data);
561                                //if (urlparams.get("cellphone_otp_id") == "") {
562                                //    input_error_handler(cc_cellphone, false, "יש לאמת את מספר הטלפון הנייד");
563                                //    form_error_handler("קיימות שגיאות בטופס");
564                                //}
565                                //else {
566                                //    if (typeof (plugin.policy_confirmation_input) !== "undefined" && $(plugin.policy_confirmation_input).length > 0) {
567                                //        urlparams.set("policy_confirmation", $(plugin.policy_confirmation_input)[0].checked);
568                                //    }
569                                //    if (typeof (plugin.mailing_confirmation_input) !== "undefined" && $(plugin.mailing_confirmation_input).length > 0) {
570                                //        urlparams.set("mailing_confirmation", $(plugin.mailing_confirmation_input)[0].checked);
571                                //    }
572                                //    if (typeof (plugin.push_confirmation_input) !== "undefined" && $(plugin.push_confirmation_input).length > 0) {
573                                //        urlparams.set("push_confirmation", $(plugin.push_confirmation_input)[0].checked);
574                                //    }
575                                //    if (typeof (plugin.interest_input) !== "undefined" && $(plugin.interest_input).length > 0) {
576                                //        var interests = [];
577                                //        $(plugin.interest_input).find("input[name='interests']:checked").each(function () {
578                                //            interests.push($(this).val());
579                                //        });
580                                //        urlparams.set("interests", interests.join(","));
581                                //    }
582                                if (urlparams != null) {
583                                    //grecaptcha.ready(function () {
584                                    //    grecaptcha.execute(plugin.settings.recaptcha_site_key, { action: 'submit' }).then(function (recaptcha_token) {
585                                    //        urlparams.set("recaptcha_token", recaptcha_token);
586                                            $.post(typeof (plugin.settings.update_url) !== "undefined" && plugin.settings.update_url !== null && plugin.settings.update_url !== "" ? plugin.settings.update_url : document.location.pathname, urlparams.toString()).done(function (data) {
587                                                const bubbleData = {
588                                                    action: "update",
589                                                    status: data.status,
590                                                    first_name: $(plugin.first_name_input).val(),
591                                                    last_name: $(plugin.last_name_input).val()
592                                                };
593                                                if (data.status) {
594
595                                                    try {
596                                                        if (typeof (data.customerCode) !== "undefined" && data.customerCode !== null) {
597                                                            dataLayer.push({
598                                                                event: 'sign_up',
599                                                                method: 'Membership Club',
600                                                                membership_club: "",
601                                                                membership_level: "",
602                     
602                                           user_id: data.customerCode
603                                                            });
604                                                        }
605                                                    }
606                                                    catch (ex) {
607
608                                                    }
609
610                                                    const urlParams = new URLSearchParams(window.location.search);
611                                                    const popupParam = urlParams.get('popup');
612                                                    if (typeof (popupParam) !== "undefined" && popupParam === "1") {
613
614                                                        var bc = new BroadcastChannel("CUSTOMERS_CLUB_REGISTRATION");
615                                                        bc.postMessage(bubbleData);
616
617                                                    } else { 
618
619                                                        var event = new CustomEvent('CUSTOMERS_CLUB_REGISTRATION', { detail: bubbleData, bubbles: true });
620                                                        $(plugin.elem)[0].dispatchEvent(event);
621
622                                                        //if (typeof gtag === 'function') gtag('event', 'Signup_club');
623                                                        sendGtagEvent("Signup_club");
624                                                        buttonSuccess(plugin.elem.submit_button, "נשמר בהצלחה");
625
626                                                        if (typeof (plugin.settings.do_not_send_to_link_after_registration_success) === "undefined" && typeof (data.link) !== "undefined") {
627
628                                                            setTimeout(function () {
629                                                                window.location.replace(data.link);
630                                                            }, 2000);
631                                                            //window.location = data.link;
632
633                                                        }
634                                                    }
635                                                }
636                                                else {
637                                                    buttonFailed(plugin.elem.submit_button, "שגיאה");
638                                                    $(plugin.elem.form).find(".error-message").text(data.message).focus();
639                                                    //plugin.elem.submit_button[0].setCustomValidity(data.message);
640                                                    //plugin.elem.submit_button[0].reportValidity();
641                                                    //setTimeout(function () {
642                                                    //    plugin.elem.submit_button[0].setCustomValidity("");
643                                                    //},3000)
644                                                }
645                                            }).fail(function () {
646                                                buttonFailed(plugin.elem.submit_button, "שגיאה");
647                                                $(plugin.elem.form).find(".error-message").text("שגיאה").focus();
648                                            });
649                                    //    });
650                                    //});
651                                }
652                            }
653                            else {
654                                form_error_handler("קיימות שגיאות בטופס");
655                            }
656                        });
657                }
658
659                if (typeof (plugin.settings.properties.disconnect) !== "undefined" && plugin.settings.properties.disconnect.show === true) {
660                    $("<button/>").prop("type", "button").addClass("link-button").css("display","block").css("text-align","center").css("color","blue").text("התנתקות מהמועדון").insertAfter(plugin.elem.form_error).on("click", function () {
661                        if (confirm("האם את/ה בטוח/ה שברצונך להתנתק מהמועדון? כל הנקודות וההטבות שצברת יאופסו.")) {
662                            //$.post("/")
663                        }
664                    });
665                }
666
667
668
669                //$(plugin.elem.form).find("input,select,.mfa-code").on("blur", function () {
670                //    if (!this.checkValidity()) {
671                //        input_error_handler(this, false, $(this).attr("data-instructor-message"));
672                //    }
673                //    else {
674                //        input_error_handler(this, true);
675                //    }
676                //});
677
678                if (typeof (plugin.settings.success_callback) !== "undefined") {
679                    plugin.settings.success_callback();
680                }
681                   
682                setTimeout(unblockPage, 1000);
683
684                var event = new CustomEvent('CUSTOMERS_CLUB_INITIATED', { detail: {} , bubbles: true });
685                $(plugin.elem)[0].dispatchEvent(event);
686            }
687
688        };
689
690        //if (typeof (grecaptcha) === "undefined") {
691        //    $.getScript("https://www.google.com/recaptcha/api.js?render=" + plugin.settings.recaptcha_site_key,init);
692        //}
693        //else {
694            init();
695        //}
696
697        return this;
698    }
699
700
701})(jQuery);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.