PageSourceSearch

https://goredpocket.com/js/plans-add-v2.js?v=1.20&ipc=1

js goredpocket.com collected 2026-10-07 03:52:16 UTC 37,628 bytes, 1,106 lines download raw bytes

1$('[data-type="ann"]').on('click', function () {
2
3    $('.add_cart_annual').css('display', 'inline-block');
4    $('.add_cart_monthly').css('display', 'none');
5
6    $('.get_esim_continue_ann').css('display', 'inline-block');
7    $('.get_esim_continue_mn').css('display', 'none');
8});
9
10$('[data-type="mn"]').on('click', function () {
11
12    $('.add_cart_monthly').css('display', 'inline-block');
13    $('.add_cart_annual').css('display', 'none');
14
15    $('.get_esim_continue_mn').css('display', 'inline-block');
16    $('.get_esim_continue_ann').css('display', 'none');
17});
18$('.povht_trig2').click(function() {
19    $('.povht_trig2').removeClass('povht_act2');
20    $('.povht_pln2').removeClass('povht_pln_act2');
21    povht = $(this).attr('data-povht');
22    $(this).addClass('povht_act2');
23    $('.' + povht).addClass('povht_pln_act2');
24    if(povht == "povht_pln_an2"){
25        $(".show_hide_ann_mn").show();
26    }else{
27        $(".show_hide_ann_mn").hide();
28    }
29});
30$('.crp_mbl_wrap1').click( function() {
31    $('.crp_mbl_wrap1').removeClass('crp_mbl_selc');
32    $(this).addClass('crp_mbl_selc');
33  });
34var form_id_global = "addPlan";
35var plan_code_global = "";
36var plan_name_global = "";
37var plan_price_global = 0;
38var plan_index_global = 0;
39var isMobileReq=$(".isMobileReq").val();
40
41
42$(document).ready(function () {
43
44    var showImeiSecRandom = $(".showImeiSecRandom").val();
45    
46    if(showImeiSecRandom == "1"){
47        // $(".need_help_decide_sim_type").trigger('click');
48    }
49    $('.setup_options .imei_check').prop('checked', true);
50
51    // When any radio button inside the loop is clicked
52    $('.setup_options input[type="radio"]').on('change', function () {
53        // Determine if esim_btn_click or phy_btn_click was selected
54
55        if ($(this).hasClass('esim_btn_click')) {
56            selectedClass = "esim_btn_click";
57        } else if ($(this).hasClass('phy_btn_click')) {
58            selectedClass = "phy_btn_click";
59        } else {
60            selectedClass = "imei_check";
61        }
62
63
64        // Update all radios within the loop to match the selection
65        $('.setup_options .' + selectedClass).prop('checked', true);
66    });
67
68
69    $('.user_in').on('input', function () {
70        let input = $(this).val();
71
72        input = input.replace(/\D/g, '');
73
74        if (input.length > 0) {
75            if (input.length <= 3) {
76                input = '(' + input.substring(0, 3);
77            } else if (input.length <= 6) {
78                input = '(' + input.substring(0, 3) + ') ' + input.substring(3, 6);
79            } else {
80                input = '(' + input.substring(0, 3) + ') ' + input.substring(3, 6) + ' - ' + input.substring(6, 10);
81            }
82        }
83        $(this).val(input);
84    });
85
86    $(".cdma_5g_popup_link").hide();
87
88    var gsma_bg_img = '<?php echo $getGsmaBg ?>';
89    var cdmas_bg_img = '<?php echo $getCdmasBg ?>';
90    var cdma_bg_img = '<?php echo $getCdmaBg ?>';
91    var gsmt_bg_img = '<?php echo $getGsmtBg ?>';
92
93
94
95    $(document).on('click', '.no_thank_keep_curr', function () {
96        var typeSelect = $('.sim_type_selection').val();
97        var isEsimValid = $('.is_esim_valid').val();
98        $('form#addPlan').submit();
99        // if (typeSelect == 1) {
100        //     updateShipping('Standard_eMail');
101        // } else {
102        //     $('form#addPlan').submit();
103        // }
104
105    });
106    $(document).on('click', '.add_upgraded_plan_cart_btn', function () {
107        $('#network-gsmt').click();
108        $('form#addPlan').submit();
109    });
110
111
112
113    
114
115
116
117    $('#product_id').val(1);
118    $('#sim-step-esn').hide();
119    $('#sim-step-3').show();
120
121
122
123
124    $('.plan-add-checks label').click(function () {
125        $(window).scrollTop(($('#title-choose').offset().top) - 150);
126    });
127
128});
129
130jQuery(function () {
131
132    $('.learn_more_trigger').mouseenter(function () {
133        $(this).siblings('.nb_dropdown').addClass('nbd_active');
134    });
135
136    $('.common_desc_class').mouseleave(function () {
137        $(this).find('.nb_dropdown').removeClass('nbd_active');
138        $('.tooltip_templates').trigger('click'); // this trigger was added to hide tooltip when user takes cursor out of a network-box
139    });
140
141});
142$(document).on('click', '.go_back_to_sim_select', function () {
143    $(".cmn_right_all_sec").hide();
144    $(".cmn_pl_flow_top_sec").hide();
145    $(".faq_main_wrapper").hide();
146    $(".show_im_esim_sec").hide();
147    $(".pick_esim_psim_top_sec").show();
148    $(".esim_psim_select_area").show();
149    $(".imei_sec_mobile_hide").show();
150    $(".cmn_go_back").hide();
151    $(".go_back_to_phone_select").show();
152});
153$(document).on('click', '.inactive_btn', function () {
154    alert('Choose the Best SIM for Your Device.');
155});
156
157
158$(document).on('click', '.div_psim_select_wrapper', function () {
159    $('.sim_type_selection').val(0);
160    eSimDeviceSelection('feature_esim_selected', 0);
161    $(".cmn_box_wrapper").removeClass('selected');
162    $(".div_psim_select_wrapper").addClass('selected');
163    $(".most-popular").removeClass('selected');
164    $(".inactive_btn").hide();
165    $(".go_to_final_add_plan_cart").show();
166    $(".esim_not_select_img").show();
167    $(".esim_select_img").hide();
168    $(".psim_not_select_img").hide();
169    
170    $(".psim_select_img").show();
171    
172});
173
174$(document).on('click', '.div_esim_select_wrapper', function () {
175    $('.sim_type_selection').val(1);
176    eSimDeviceSelection('feature_esim_selected', 1);
177
178    $(".cmn_box_wrapper").removeClass('selected');
179    $(".div_esim_select_wrapper").addClass('selected');
180    $(".most-popular").addClass('selected');
181    $(".inactive_btn").hide();
182    $(".go_to_final_add_plan_cart").show();
183
184    $(".psim_not_select_img").show();
185    $(".psim_select_img").hide();
186    $(".esim_not_select_img").hide();
187    $(".esim_select_img").show();
188});
189
190function pushAddToCartDataLayer(network) {
191    var itemId = $('.dl_item_id').val();
192    var itemName = $('.dl_item_name').val() || '';
193    var basePrice = parseFloat($('.dl_price').val()) || 0;
194    var finalPrice = parseFloat($('.dl_final_price').val()) || basePrice;
195    var simTypeVal = parseInt($('.sim_type_selection').val());
196    var itemVariant = simTypeVal === 1 ? 'esim' : 'physical';
197    var discount = parseFloat((basePrice - finalPrice).toFixed(2));
198
199    var dlItem = {
200        item_id: itemId,
201        item_name: itemName,
202        item_category: 'Prepaid',
203        item_category2: network,
204        item_variant: itemVariant,
205        price: basePrice,
206        discount: discount > 0 ? discount : 0,
207        quantity: 1
208    };
209    console.log('dlItem', dlItem);
210
211    window.dataLayer = window.dataLayer || [];
212    window.dataLayer.push({ ecommerce: null });
213    window.dataLayer.push({
214        event: 'add_to_cart',
215        ecommerce: {
216            currency: 'USD',
217            value: finalPrice > 0 ? finalPrice : basePrice,
218            items: [dlItem]
219        }
220    });
221}
222
223$(document).on('click', '.final_add_plan_cart', function () {
224    var typeSelect = $('.sim_type_selection').val();
225    var isEsimValid = $('.is_esim_valid').val();
226    form_id_global = $('.form_id').val();
227    pushAddToCartDataLayer('GSMA');
228    $('#' + form_id_global).submit();
229    // if (typeSelect == 1) {
230    //     updateShippingGlobal('Standard_eMail');
231    // } else {
232    //     $('#' + form_id_global).submit();
233    // }
234});
235
236$(document).on('click', '.go_back_to_phone_select', function () {
237    $(".show_pl_new_own_ph").show();
238    $(".esim_psim_select_area").hide();
239    $(".cmn_pl_flow_top_sec").hide();
240    $(".pick_a_plan_top_sec").show();
241    $(".cmn_go_back").hide();
242    $(".go_back_to_plans").show();
243});
244
245$(document).on('click', '.pl_own_ph_select', function () {
246    $(".show_pl_new_own_ph").hide();
247    $(".esim_psim_select_area").show();
248    $(".cmn_pl_flow_top_sec").hide();
249    $(".pick_esim_psim_top_sec").show();
250    $(".cmn_go_back").hide();
251    $(".go_back_to_phone_select").show();
252});
253function imeiEneretedEsimTrigger() {
254    eSimDeviceSelection('feature_esim_selected', 1);
255    $(".cmn_box_wrapper").removeClass('selected');
256    $(".div_esim_select_wrapper").addClass('selected');
257
258    $(".sim_type_selection").val(1);
259    $(".cmn_pl_flow_top_sec").hide();
260    $(".esim_psim_select_area").hide();
261    $(".faq_main_wrapper").hide();
262    $(".show_im_esim_sec").hide();
263    $(".complete_order_sec").show();
264    $(".compl_final_imei_esim_dual_top_sec").show();
265    $(".esim_sect_show_cmp_ar").show();
266    $('html, body').animate({
267        scrollTop: 0
268    }, 2000);
269}
270function imeiEneretedPsimTrigger(){
271    $('.sim_type_selection').val(0);
272    eSimDeviceSelection('feature_esim_selected', 0);
273    $(".cmn_box_wrapper").removeClass('selected');
274    $(".div_psim_select_wrapper").addClass('selected');
275    $(".most-popular").removeClass('selected');
276    $(".inactive_btn").hide();
277    $(".go_to_final_add_plan_cart").show();
278    $(".esim_not_select_img").show();
279    $(".faq_main_wrapper").hide();
280    $(".show_im_esim_sec").hide();
281    $(".esim_select_img").hide();
282    $(".psim_not_select_img").hide();
283    $(".psim_select_img").show();
284
285    $(".cmn_pl_flow_top_sec").hide();
286    $(".complete_order_sec").show();
287    $(".compl_final_imei_psim_only_top_sec").show();
288    $(".esim_sect_show_cmp_ar").hide();
289    $('html, body').animate({
290        scrollTop: 0
291    }, 2000);
292}
293
294$(document).on('click', '.skip_imei_btn', function () {
295    eSimDeviceSelection('feature_esim_selected', 1);
296    $(".cmn_box_wrapper").removeClass('selected');
297    $(".div_esim_select_wrapper").addClass('selected');
298
299    $(".sim_type_selection").val(1);
300    $(".cmn_pl_flow_top_sec").hide();
301    $(".esim_psim_select_area").hide();
302    $(".faq_main_wrapper").hide();
303    $(".show_im_esim_sec").hide();
304    $(".complete_order_sec").show();
305    $(".compl_final_esim_top_sec").show();
306    $(".esim_sect_show_cmp_ar").show();
307});
308$(document).on('click', '.sw_to_psim_radio', function () {
309    $('.sm_radio_type').prop('checked', true);
310    $(".sim_type_selection").val(0);
311    eSimDeviceSelection('feature_esim_selected', 0);
312    $(".cmn_box_wrapper").removeClass('selected');
313    $(".div_psim_select_wrapper").addClass('selected');
314
315});
316$(document).on('click', '.go_to_final_add_plan_cart', function () {
317    
318    $(".cmn_pl_flow_top_sec").hide();
319    $(".esim_psim_select_area").hide();
320    $(".complete_order_sec").show();
321    
322    $(".esim_sect_show_cmp_ar").hide();
323   
324    var simtype=$('.sim_type_selection').val();
325    if(simtype == "1"){
326        $(".compl_final_esim_top_sec").show();
327    }else{
328        $(".compl_final_psim_top_sec").show();
329    }
330    $('html, body').animate({
331        scrollTop: 0
332    }, 2000);
333    return false;
334});
335$(document).on('click', '.need_help_decide_sim_type', function () {
336    $(".cmn_right_all_sec").hide();
337    $(".cmn_pl_flow_top_sec").hide();
338    $(".compl_final_imei_top_sec").show();
339    $(".show_pl_new_own_ph").hide();
340    $(".esim_psim_select_area").hide();
341    $(".cmn_go_back").hide();
342    $(".go_back_to_sim_select").show();
343    $(".faq_main_wrapper").show();
344    $(".show_im_esim_sec").show();
345    if(isMobileReq == "1"){
346        $(".imei_sec_mobile_hide").hide();
347    }
348    $('html, body').animate({
349        scrollTop: 0
350    }, 2000);
351});
352$(document).on('click', '.continue_after_sim_type_select', function () {
353    $(".show_pl_new_own_ph").hide();
354    $(".esim_psim_select_area").hide();
355    $(".all_set_final_sec").show();
356});
357$(document).on('click', '.pl_by_new_php_select', function () {
358    location.href = "/shop";
359});
360$(document).on('click', '.cmn_add_to_cart_btn', function () {
361    var shash = $(this).attr('data-shash');
362    var code = $(this).attr('data-code');
363    $(".shash").val(shash);
364    $(".pName").val(code);
365    $(".cmn_selected_ar").hide();
366    $(".pg2_" + code).show();
367    toggleDiv('promotion_slide');
368});
369
370$(document).on('click', '.plan_select_show_step_2', function () {
371    // $(".main_plan_slide").hide();
372    // $(".add_cart_slide").show();
373
374    var getPlanName=$(".pName").val();
375    if(getPlanName == ""){
376        // alert('Please select plan');
377
378    $(".empty_plan").show();
379        return false;
380    }
381
382    if(form_id_global == "addPlanAnnual"){
383        location.href = "/plans/gsma/"+getPlanName;
384    }else{
385        location.href = "/plan/add/"+getPlanName;
386    }
387    // $(".main_plan_slide").removeClass("visible");
388    // $(".add_cart_slide").addClass("visible");
389
390});
391$(document).on('click', '.plan_select_for_step_2', function () {
392    var shash = $(this).attr('data-shash');
393    var code = $(this).attr('data-code');
394    var sku = $(this).attr('data-sku');
395    var dataType = $(this).attr('data-type');
396
397    var planName = $(this).attr('data-name') || '';
398    var planPrice = parseFloat($(this).attr('data-price')) || 0;
399    var planSPrice = parseFloat($(this).attr('data-sprice')) || 0;
400    var discount = parseFloat($(this).attr('data-disc')) || 0;
401    var planIndex = $('[data-type="' + dataType + '"].plan_select_for_step_2').index(this);
402    var itemListName = dataType === 'ann' ? 'Yearly Plans' : 'Monthly Plans';
403
404    window.dataLayer = window.dataLayer || [];
405    window.dataLayer.push({ ecommerce: null });
406    window.dataLayer.push({
407        event: 'select_item',
408        ecommerce: {
409            item_list_id: 'plans_listing',
410            item_list_name: itemListName,
411            items: [{
412                item_id: sku,
413                item_name: planName,
414                item_category: 'Prepaid',
415                item_category2: 'GSMA',
416                price: planSPrice,
417                discount: discount,
418                currency: 'USD',
419                index: planIndex
420            }]
421        }
422    });
423
424    if (dataType == "ann") {
425        form_id_global = "addPlanAnnual";
426        $(".shashAnn").val(shash);
427    } else {
428        form_id_global = "addPlan";
429        $(".shash").val(shash);
430    }
431
432    $(".pName").val(code);
433    $(".cmn_selected_ar").hide();
434    $(".pg2_" + code).show();
435
436
437    $(".cmn_pl_box_wrap").removeClass('crp_desk_selc');
438    $(".act_pl_box_swap_"+code).addClass('crp_desk_selc');
439
440    $(".plan_select_show_step_2").addClass('pln_stp_btn_act');
441    $(".cmn_mob_plan_sub_sec").hide();
442    $(".main_mob_plan_sub_sec_" + code).show();
443
444});
445$(document).on('click', '.go_back_to_plan_slide', function () {
446
447    $(".add_cart_slide").removeClass("visible");
448    $(".main_plan_slide").addClass("visible");
449    
450    // $(".add_cart_slide").hide();
451    // $(".main_plan_slide").show();
452});
453var contextElement = $('.mn_pre_sel_MH20R').get(0);
454if (contextElement) {
455    // monTriger(contextElement);
456}
457var showAnnual = $(".showAnnual").val();
458if (showAnnual == "1") {
459    var contextElementAnn = $('.mn_pre_sel_EH20R').get(0);
460    if (contextElementAnn) {
461        // monTriger(contextElementAnn);
462    }
463}
464$(document).on('click', '.an_tb', function () {
465    var contextElementAnn = $('.mn_pre_sel_EH20R').get(0);
466    if (contextElementAnn) {
467        // monTriger(contextElementAnn);
468    }
469});
470$(document).on('click', '.physicalSimSelectionMn', function () {
471    monTriger(this);
472    $(this).closest('.povht_pln').removeClass('povht_pln_pre_selc');
473});
474
475function monTriger(context) {
476    var shash = $(context).attr('data-shash');
477    var code = $(context).attr('data-code');
478    var dataType = $(context).attr('data-type');
479    plan_code_global = code;
480    $(".rcpt_item").hide();
481    $(".setup_options").hide();
482
483    if (dataType == "ann") {
484        form_id_global = "addPlanAnnual";
485        $(".shashAnn").val(shash);
486        $(".an_sim_select_" + code).show();
487    } else {
488        form_id_global = "addPlan";
489        $(".shash").val(shash);
490        $(".mn_sim_select_" + code).show();
491    }
492    var topLbl = $(".cst_ann_top_lbl_" + code).val();
493    // if (code == "E10GR") {
494    //     topLbl += " on Plus";
495    //     var cstHtml = 'Buy 8 months, <span>get 4 free</span>';
496    // } else {
497    //     var cstHtml = 'Buy 10 months, <span>get 2 free</span>';
498
499    // }
500
501    // $(".ann_mn_pr_top_lbl").html(topLbl);
502    // $(".ann_mn_pr_lbl").html(cstHtml);
503    $('.povh_col_wrap_1').removeClass('curr_pln');
504    $(context).closest('.povh_col_wrap_1').addClass('curr_pln');
505    $(".pName").val(code);
506    $(".cmn_selected_ar").hide();
507    $(".pg2_" + code).show();
508
509}
510
511$(document).on('click', '.show_fact', function () {
512
513    var code = $(this).attr('data-code');
514    var dataType = $(this).attr('data-type');
515
516
517
518    var mainContainELe = $(".main_contain_" + code);
519    if (mainContainELe.hasClass("curr_pln")) {
520        $('.povh_col_wrap_1').removeClass('curr_pln');
521        $(".rcpt_item").hide();
522        $(".setup_options").hide();
523        $(this).closest('.povht_pln').addClass('povht_pln_pre_selc');
524    } else {
525        if (dataType == "ann") {
526            let element = $(".an_rcpt_select_" + code);
527
528            if (element.is(":visible")) {
529                $(".an_rcpt_select_" + code).hide();
530            } else {
531                $(".an_rcpt_select_" + code).show();
532            }
533
534        } else {
535            let element = $(".mn_rcpt_select_" + code);
536
537            if (element.is(":visible")) {
538                $(".mn_rcpt_select_" + code).hide();
539            } else {
540                $(".mn_rcpt_select_" + code).show();
541            }
542        }
543    }
544
545
546
547});
548
549
550
551function request_feature_list(f_name, f_val) {
552    var post_data = {
553        f_name: f_name,
554        f_val: f_val,
555    };
556    jQuery.ajax({
557        url: "/shop/feature-list-select",
558        type: "POST",
559        dataType: 'json',
560        async: true,
561        data: { post_data: post_data },
562        beforeSend: function (data) { },
563        success: function (data) {
564        },
565        error: function (data) { }
566    });
567
568}
569$(document).on('click', '.cst_add_iphone_btn', function () {
570    location.href = "/shop/iphone/apple-iphone-se";
571
572});
573
574$(document).on('click', '.change_product_color', function () {
575
576    var id = $(this).attr('data-id');
577    $(".change_product_color").removeClass('is_selected_yes');
578    $(this).addClass('is_selected_yes');
579    var getPmrImg = $(".pmr_img_" + id).val();
580    var is_available = $(".is_available_" + id).val();
581    if (is_available == "1") {
582        $(".cst_ip_main_img").attr('src', getPmrImg);
583        request_feature_list('feature_list_color_id', id);
584    } else {
585        return false;
586    }
587});
588
589
590$(document).on('click', '.add_cart_plan_btn_bogo', function () {
591    $('#bogo_savings_popup').modal('show');
592    return false;
593});
594
595
596
597function userImeiCheck(imei) {
598    var googleEnterpriseCaptchaSiteKey = $(".googleEnterpriseCaptchaSiteKey").val();
599    var imeiCsrf = $(".csrf_validate").val();
600    var token;
601    document.getElementById('alertbox-waiting-text').hidden = false;
602    var imei = imei.replace(/[^0-9]/g, '');
603
604    var div = document.getElementById('alertbox-waiting-text');
605    var loadHtml = '<section class="loader_container" id="loader"><div class="loader"><div class="spinner "></div><p class="medium weight_large mt_2">LOADING...</p><div class="fun_facts "><div><p class="medium weight_large mt_1">FUN FACTS:</p><p>The telephone is the most profitable invention in U.S. History.</p></div></div></div></section>';
606    div.innerHTML = loadHtml;
607
608    grecaptcha.enterprise.ready(async () => {
609        token = await grecaptcha.enterprise.execute(googleEnterpriseCaptchaSiteKey, { action: 'login' });
610        jQuery.ajax({
611            url: "/shop/check-user-imei",
612            type: "POST",
613            dataType: 'json',
614            async: false,
615            data: { imei: imei, token: token, imeiCsrf: imeiCsrf },
616
617            beforeSend: function (data) {
618                document.getElementById('alertbox-waiting-text').hidden = false;
619
620                var div = document.getElementById('alertbox-waiting-text');
621                var loadHtml = '<section class="loader_container" id="loader"><div class="loader"><div class="spinner "></div><p class="medium weight_large mt_2">LOADING...</p><div class="fun_facts "><div><p class="medium weight_large mt_1">FUN FACTS:</p><p>The telephone is the most profitable invention in U.S. History.</p></div></div></div></section>';
622                div.innerHTML = loadHtml;
623            },
624            success: function (data) {
625                document.getElementById('alertbox-waiting-text').hidden = true;
626                var div = document.getElementById('alertbox-waiting-text');
627                
628                if (data.return_code == "1") {
629                    $(".imei_select_in").val(1);
630                    var return_data = data.return_data;
631                    if (return_data.popupType == "plan") {
632                        if (return_data.isBoth == "1") {
633                            // $("#usm_prompt_7").modal('show');
634                            // setSimTypeAndSubmit('feature_esim_selected', 1);
635                            imeiEneretedEsimTrigger();
636                        } else if (return_data.isEsim == "1") {
637                            // $("#usm_prompt_5").modal('show');
638                            // setSimTypeAndSubmit('feature_esim_selected', 1);
639                            imeiEneretedEsimTrigger();
640                            
641                        } else if (return_data.isPsim == "1") {
642                            // $("#usm_prompt_6").modal('show');
643                            // setSimTypeAndSubmit('feature_esim_selected', 0);
644                            imeiEneretedPsimTrigger();
645                        }
646                    } else if (return_data.popupType == "block") {
647                        $("#usm_prompt_9").modal('show');
648
649                    } else if (return_data.popupType == "wearables") {
650                        $("#usm_prompt_11").modal('show');
651                    } else if (return_data.popupType == "broadband") {
652                        $("#usm_prompt_10").modal('show');
653
654                    } else if (return_data.popupType == "warning") {
655                        $("#usm_prompt_8").modal('show');
656                    } else {
657                        $("#usm_prompt_3").modal('show');
658                    }
659
660                } else {
661                    $(".cmn_pl_flow_top_sec").hide();
662                    $(".compl_final_not_compl_top_sec").show();
663                    $(".faq_main_wrapper").hide();
664                    $(".show_im_esim_sec").hide();
665                    $(".imei_not_compatible").show();
666                   
667                }
668
669            },
670            error: function (data) {
671                document.getElementById('alertbox-waiting-text').hidden = true;
672                var div = document.getElementById('alertbox-waiting-text');
673                div.innerHTML = '<div class="error"><h2>Error! Please contact customer support.</h2></div>';
674            }
675        });
676
677    });
678
679}
680$(document).on('click', '.go_back_to_imei_sec', function () {
681    
682    $(".cmn_right_all_sec").hide();
683    $(".cmn_pl_flow_top_sec").hide();
684    $(".compl_final_imei_top_sec").show();
685    $(".imei_not_compatible").hide();
686    $(".faq_main_wrapper").show();
687    $(".show_im_esim_sec").show();
688
689});
690$(document).on('click', '.get_esim_continue_mn', function () {
691    form_id_global = "addPlan";
692    $('.sim_type_selection').val(1);
693    setSimTypeAndSubmit('feature_esim_selected', 1);
694
695});
696$(document).on('click', '.get_esim_continue_ann', function () {
697    form_id_global = "addPlanAnnual";
698    $('.sim_type_selection').val(1);
699    setSimTypeAndSubmit('feature_esim_selected', 1);
700
701});
702$(document).on('click', '.get_esim_continue', function () {
703    $('.sim_type_selection').val(1);
704    setSimTypeAndSubmit('feature_esim_selected', 1);
705
706});
707$(document).on('click', '.get_psim_continue', function () {
708    $('.sim_type_selection').val(0);
709    setSimTypeAndSubmit('feature_esim_selected', 0);
710
711});
712
713function setSimTypeAndSubmit(f_name, f_val) {
714    var post_data = {
715        f_name: f_name,
716        f_val: f_val,
717    };
718    jQuery.ajax({
719        url: "/plans/e-sim-device-selection",
720        type: "POST",
721        dataType: 'json',
722        async: true,
723        data: { post_data: post_data },
724        beforeSend: function (data) { },
725        success: function (data) {
726            $('.sim_type_selection').val(f_val);
727            $('#' + form_id_global).submit();
728            // if (f_val == "1") {
729            //     updateShippingGlobal('Standard_eMail');
730            // } else {
731            //     $('#' + form_id_global).submit();
732            // }
733            
734        },
735        error: function (data) { }
736    });
737}
738$('.cmn_mob_imei').on('keyup', function () {
739    var getCode = $(this).attr('data-code');
740    const imei = $('.imei_in_' + getCode).val();
741    const confImei = $(this).val();
742
743    if (imei === confImei) {
744        $('.imei_in_' + getCode).css('border', '1px solid green');
745        $('.imei2_in_' + getCode).css('border', '1px solid green');
746    } else {
747        $('.imei2_in_' + getCode).css('border', '1px solid red');
748    }
749});
750// $('.imei2_in_desk').on('keyup', function () {
751//     const imei = $('.imei_in_desk').val();
752//     const confImei = $(this).val();
753
754//     if (imei === confImei) {
755//       $('.imei_in_desk').css('border', '1px solid green');
756//       $('.imei2_in_desk').css('border', '1px solid green');
757//     } else {
758//       $('.imei2_in_desk').css('border', '1px solid red');
759//     }
760//   });
761$(document).on('click', '.add_cart_monthly', function () {
762
763    var typeSelect = $('.sim_type_selection').val();
764    var isEsimValid = $('.is_esim_valid').val();
765    var getVer = $(this).attr('data-ver');
766    if (getVer == "mob") {
767        var imeiIn = $('.imei_in_' + plan_code_global).val();
768        var imei2In = $('.imei2_in_' + plan_code_global).val();
769    } else {
770        var imeiIn = $('.imei_in_desk').val();
771        var imei2In = $('.imei2_in_desk').val();
772    }
773    if (imeiIn == "" || imeiIn == " ") {
774        alert('Not quite right. Check your IMEI and give it another go.');
775        return false;
776    }
777    form_id_global = "addPlan";
778    userImeiCheck(imeiIn);
779    // if (typeSelect == 0) {
780    //     if (imeiIn == "" || imeiIn == " ") {
781    //         alert('please enter valid IMEI');
782    //         return false;
783    //     }
784    //     form_id_global="addPlan";
785    //     userImeiCheck(imeiIn);
786    //     return;
787    // }
788
789    // if (typeSelect == 1 && isEsimValid == 1) { } else {
790    //     $(".cst_esim_response_message").html('');
791    // }
792
793
794    // if (typeSelect == 1) {
795
796    //     updateShipping('Standard_eMail');
797    // } else {
798    //     $('#addPlan').submit();
799    // }
800
801});
802$(document).on('click', '.add_cart_annual', function () {
803
804    var typeSelect = $('.sim_type_selection').val();
805    var isEsimValid = $('.is_esim_valid').val();
806    var getVer = $(this).attr('data-ver');
807    if (getVer == "mob") {
808        var imeiIn = $('.imei_in_' + plan_code_global).val();
809    } else {
810        var imeiIn = $('.imei_in_desk').val();
811    }
812    if (imeiIn == "" || imeiIn == " ") {
813        alert('please enter valid IMEI');
814        return false;
815    }
816    form_id_global = "addPlanAnnual";
817    userImeiCheck(imeiIn);
818    // if (typeSelect == 0) {
819    //     if (imeiIn == "" || imeiIn == " ") {
820    //         alert('please enter valid IMEI');
821    //         return false;
822    //     }
823    //     form_id_global="addPlanAnnual";
824    //     userImeiCheck(imeiIn);
825    //     return;
826    // }
827
828    // if (typeSelect == 1 && isEsimValid == 1) { } else {
829    //     $(".cst_esim_response_message").html('');
830    // }
831
832
833    // if (typeSelect == 1) {
834
835    //     updateShippingAnn('Standard_eMail');
836    // } else {
837    //     $('#addPlanAnnual').submit();
838    // }
839
840});
841function updateShippingAnn(tk) {
842
843
844    jQuery.ajax({
845        url: "/shop/update-shipping",
846        type: "POST",
847        dataType: 'json',
848        async: false,
849        data: { type: tk },
850
851        beforeSend: function (data) {
852            document.getElementById('alertbox-waiting-text').hidden = false;
853
854            var div = document.getElementById('alertbox-waiting-text');
855            var loadHtml = '<section class="loader_container" id="loader"><div class="loader"><div class="spinner "></div><p class="medium weight_large mt_2">LOADING...</p><div class="fun_facts "><div><p class="medium weight_large mt_1">FUN FACTS:</p><p>The telephone is the most profitable invention in U.S. History.</p></div></div></div></section>';
856            div.innerHTML = loadHtml;
857        },
858        success: function (data) {
859            document.getElementById('alertbox-waiting-text').hidden = true;
860            var div = document.getElementById('alertbox-waiting-text');
861            if (data.return_code != 1) { } else {
862                $('#addPlanAnnual').submit();
863            }
864
865        },
866        error: function (data) {
867            document.getElementById('alertbox-waiting-text').hidden = true;
868            var div = document.getElementById('alertbox-waiting-text');
869            div.innerHTML = '<div class="error"><h2>Error! Please contact customer support.</h2></div>';
870        }
871    });
872}
873function updateShippingGlobal(tk) {
874
875
876    jQuery.ajax({
877        url: "/shop/update-shipping",
878        type: "POST",
879        dataType: 'json',
880        async: false,
881        data: { type: tk },
882
883        beforeSend: function (data) {
884            document.getElementById('alertbox-waiting-text').hidden = false;
885
886            var div = document.getElementById('alertbox-waiting-text');
887            var loadHtml = '<section class="loader_container" id="loader"><div class="loader"><div class="spinner "></div><p class="medium weight_large mt_2">LOADING...</p><div class="fun_facts "><div><p class="medium weight_large mt_1">FUN FACTS:</p><p>The telephone is the most profitable invention in U.S. History.</p></div></div></div></section>';
888            div.innerHTML = loadHtml;;
889        },
890        success: function (data) {
891            document.getElementById('alertbox-waiting-text').hidden = true;
892            var div = document.getElementById('alertbox-waiting-text');
893            if (data.return_code != 1) { } else {
894                $('#' + form_id_global).submit();
895            }
896
897        },
898        error: function (data) {
899            document.getElementById('alertbox-waiting-text').hidden = true;
900            var div = document.getElementById('alertbox-waiting-text');
901            div.innerHTML = '<div class="error"><h2>Error! Please contact customer support.</h2></div>';
902        }
903    });
904}
905function updateShipping(tk) {
906
907
908    jQuery.ajax({
909        url: "/shop/update-shipping",
910        type: "POST",
911        dataType: 'json',
912        async: false,
913        data: { type: tk },
914
915        beforeSend: function (data) {
916            document.getElementById('alertbox-waiting-text').hidden = false;
917
918            var div = document.getElementById('alertbox-waiting-text');
919            var loadHtml = '<section class="loader_container" id="loader"><div class="loader"><div class="spinner "></div><p class="medium weight_large mt_2">LOADING...</p><div class="fun_facts "><div><p class="medium weight_large mt_1">FUN FACTS:</p><p>The telephone is the most profitable invention in U.S. History.</p></div></div></div></section>';
920            div.innerHTML = loadHtml;
921        },
922        success: function (data) {
923            document.getElementById('alertbox-waiting-text').hidden = true;
924            var div = document.getElementById('alertbox-waiting-text');
925            if (data.return_code != 1) { } else {
926                $('#addPlan').submit();
927            }
928
929        },
930        error: function (data) {
931            document.getElementById('alertbox-waiting-text').hidden = true;
932            var div = document.getElementById('alertbox-waiting-text');
933            div.innerHTML = '<div class="error"><h2>Error! Please contact customer support.</h2></div>';
934        }
935    });
936}
937$(document).on('click', '.esim_btn_click', function () {
938    $(".cmn_sim_type").removeClass('is_active');
939    $(".esim_btn_click").addClass('is_active');
940    $('.sim_type_selection').val(1);
941    // $(".esim_select_device_model").val(0).change();
942    $(".esim_select_device_model option[data-all=all]").show();
943    $(".no_choice").hide();
944    $(".esimModal").show();
945    $(".cst_esim_response_message").html('');
946    $(".cst_esim_response_message").show();
947
948    eSimDeviceSelection('feature_esim_selected', 1);
949});
950$(document).on('click', '.phy_btn_click', function () {
951    $(".cmn_sim_type").removeClass('is_active');
952    $(".phy_btn_click").addClass('is_active');
953    $('.sim_type_selection').val(2);
954    // $(".cst_esim_response_message").html('');
955    $(".esimModal").hide();
956    $(".cst_esim_response_message").hide();
957    $(".no_choice").show();
958    eSimDeviceSelection('feature_esim_selected', 0);
959    // $(".cst_esim_response_message").html('');
960    // $(".esim_select_make_dd").val(0).change();
961    // $('.esim_select_device_model').html('');
962    var $deviceModelSelect = $('.esim_select_device_model');
963
964    // var $option1 = $("<option/>", {
965    //                 value: 0,
966    //                 text: 'Please select device model'
967    // });
968    // $deviceModelSelect.append($option1);
969});
970$(document).on('click', '.imei_check', function () {
971    $(".cmn_sim_type").removeClass('is_active');
972    $(".imei_check").addClass('is_active');
973    $('.sim_type_selection').val(0);
974    // $(".cst_esim_response_message").html('');
975    $(".esimModal").hide();
976    $(".cst_esim_response_message").hide();
977    $(".no_choice").show();
978    eSimDeviceSelection('feature_esim_selected', 0);
979    // $(".cst_esim_response_message").html('');
980    // $(".esim_select_make_dd").val(0).change();
981    // $('.esim_select_device_model').html('');
982    var $deviceModelSelect = $('.esim_select_device_model');
983
984    // var $option1 = $("<option/>", {
985    //                 value: 0,
986    //                 text: 'Please select device model'
987    // });
988    // $deviceModelSelect.append($option1);
989});
990$(document).on('click', '.switch_to_20gb', function () {
991    $("#id_final_sku").val('M20GRPGAz');
992    var typeSelect = $('.sim_type_selection').val();
993    var isEsimValid = $('.is_esim_valid').val();
994    $('form#addPlan').submit();
995    // if (typeSelect == 1) {
996    //     updateShipping('Standard_eMail');
997    // } else {
998    //     $('form#addPlan').submit();
999    // }
1000
1001});
1002$(document).on('click', '.add_plan_to_cart_btn', function () {
1003    var typeSelect = $('.sim_type_selection').val();
1004    var isEsimValid = $('.is_esim_valid').val();
1005    $('form#addPlan').submit();
1006    // if (typeSelect == 1) {
1007
1008    //     updateShipping('Standard_eMail');
1009    // } else {
1010    //     $('form#addPlan').submit();
1011    // }
1012
1013});
1014$(document).on('click', '.cst_buy_esim_link', function () {
1015    $(".esim_select_make_dd").val(0).change();
1016    $("#esim_validation_modal").modal('show');
1017});
1018
1019$(document).on('click', '.recheck_esim_device_model', function (event) {
1020
1021    $(".esim_step_2").hide();
1022    $(".esim_step_1").show();
1023    $(".cst_esim_response_message").html('');
1024    $(".esim_select_make_dd").val(0).change();
1025    // $('.esim_select_device_model').html('');
1026});
1027
1028
1029$(document).on('change', '.esim_select_make_dd', function (event) {
1030
1031    $(".cst_esim_response_message").html('');
1032
1033    var getDeviceMake = $(".esim_select_make_dd").val();
1034    if (getDeviceMake == "0") {
1035        $(".esim_select_device_model option[data-all=all]").show();
1036    } else {
1037        $(".esim_select_device_model option[data-all=all]").hide();
1038        $(".esim_select_device_model option[data-make=" + getDeviceMake + "]").show();
1039    }
1040
1041    // eSimDeviceSelection('eSimDeviceMake',getDeviceMake);
1042
1043});
1044$(document).on('change', '.esim_select_device_model', function (event) {
1045
1046    $(".cst_esim_response_message").html('');
1047    var getDeviceModel = $(".esim_select_device_model").val();
1048    eSimDeviceSelection('eSimDeviceModel', getDeviceModel);
1049});
1050
1051
1052$(document).on('click', '.validate_esim_device_btn', function (event) {
1053
1054    $(".cst_esim_response_message").html('');
1055
1056    var getDeviceModel = $(".esim_select_device_model").val();
1057
1058    //  eSimDeviceSelection('eSimDeviceModel',getDeviceModel);
1059
1060});
1061
1062
1063
1064function eSimDeviceSelection(f_name, f_val) {
1065    var post_data = {
1066        f_name: f_name,
1067        f_val: f_val,
1068    };
1069    jQuery.ajax({
1070        url: "/plans/e-sim-device-selection",
1071        type: "POST",
1072        dataType: 'json',
1073        async: true,
1074        data: { post_data: post_data },
1075        beforeSend: function (data) { },
1076        success: function (data) {
1077            var getReturnData = data.return_data;
1078            if (f_name.localeCompare('eSimDeviceMake') === 0) {
1079                $(".is_esim_valid").val(0);
1080                if (getReturnData == '' || getReturnData == " ") {
1081                    $(".cst_esim_response_message").html('<span class="red_text">Selected model does not support eSIM. Please select a compatible model.</span>');
1082                    return false;
1083                }
1084
1085            }
1086            if (f_name.localeCompare('eSimDeviceModel') === 0) {
1087                if (getReturnData == "1") {
1088                    eSimDeviceSelection('feature_esim_selected', 1);
1089                    $(".is_esim_valid").val(1);
1090                    var outHtml = "<b><i>Congratulations!</i></b> Your phone is compatible with eSIM!<br>  Activate it immediately after purchase or at a later time.";
1091                    $(".cst_esim_response_message").html(outHtml);
1092                    $(".esim_step_1").hide();
1093                    $(".esim_step_2").show();
1094
1095                } else {
1096                    eSimDeviceSelection('feature_esim_selected', 0);
1097                    $(".is_esim_valid").val(0);
1098                    $(".cst_esim_response_message").html('<span class="red_text">Selected model does not support eSIM. Please select a compatible model.</span>');
1099                }
1100
1101            }
1102
1103        },
1104        error: function (data) { }
1105    });
1106}

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.