PageSourceSearch

https://ar15discounts.com/wp-content/plugins/dbi-application/asset…/locationOrderRouting/state/index.js?v=015

js ar15discounts.com collected 2026-09-25 23:43:04 UTC 3,430 bytes, 97 lines download raw bytes

1import { store } from '@wordpress/interactivity';
2
3const { state } = store('dbi/lor', {
4    state: {
5        isSaving: false,
6        ajaxPauseUntil: 0,
7
8        get isAjaxPaused() {
9            return Date.now() < state.ajaxPauseUntil;
10        },
11
12        isCheckoutDisabled: false,
13
14        get showMultipleFulfillmentNotice() {
15            if (!state.isCartViewPage) return false;
16
17            const options = Object.values(state.productSelections);
18            const types = new Set(
19                options.map(o => o.fulfillmentOption).filter(Boolean),
20            );
21
22            return types.size > 1;
23        },
24
25        get multipleFulfillmentNoticeMessage() {
26            const counts = { shipToHome: 0, localPickup: 0, shipToFfl: 0 };
27            const labels = {
28                shipToHome: 'Ship to home',
29                localPickup: 'Local pick up',
30                shipToFfl: 'Ship to FFL',
31            };
32
33            for (const sel of Object.values(state.productSelections)) {
34                if (sel.fulfillmentOption && counts.hasOwnProperty(sel.fulfillmentOption)) {
35                    counts[sel.fulfillmentOption]++;
36                }
37            }
38
39            let message = '';
40            for (const [option, count] of Object.entries(counts)) {
41                if (count > 0) {
42                    message += `${count} item(s) ${labels[option]}<br>`;
43                }
44            }
45
46            return message;
47        },
48
49        get showStateDivergenceWarning() {
50            if (!state.userData.state) return false;
51
52            const hasLocalPickup = Object.values(state.productSelections).some(
53                s => s.fulfillmentOption === 'localPickup',
54            );
55
56            if (!hasLocalPickup) return false;
57
58            for (const sel of Object.values(state.productSelections)) {
59                if (sel.fulfillmentOption === 'localPickup' && sel.locationId) {
60                    const salePoint = state.salePoints.find(
61                        sp => sp.id === sel.locationId,
62                    );
63                    if (salePoint) {
64                        const spName = salePoint.name || '';
65                        const spState = spName.split('-')[1]?.trim();
66                        if (spState && spState !== state.userData.state) {
67                            return true;
68                        }
69                    }
70                }
71            }
72
73            return false;
74        },
75
76        get stateDivergenceMessage() {
77            if (!state.showStateDivergenceWarning) return '';
78
79            for (const sel of Object.values(state.productSelections)) {
80                if (sel.fulfillmentOption === 'localPickup' && sel.locationId) {
81                    const salePoint = state.salePoints.find(
82                        sp => sp.id === sel.locationId,
83                    );
84                    if (salePoint) {
85                        const spName = salePoint.name || '';
86                        const spState = spName.split('-')[1]?.trim();
87                        if (spState && spState !== state.userData.state) {
88                            return `You've selected pickup in <strong>${spState}</strong> but your billing address is in <strong>${state.userData.state}</strong>. Please review and confirm your fulfillment options.`;
89                        }
90                    }
91                }
92            }
93
94            return '';
95        },
96    },
97});

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.