PageSourceSearch

https://rasushi.com/wp-content/plugins/fanatic-opentable-plugin/assets/js/opentable-api.js?ver=2.0.2

js rasushi.com collected 2026-10-03 22:56:17 UTC 6,419 bytes, 164 lines download raw bytes

1/**
2 * Fanatic OpenTable Plugin Front-end API
3 */
4(function($) {
5    'use strict';
6    
7    // OpenTable API Handler
8    var OpenTableAPI = {
9        /**
10         * Get restaurant dining information
11         * 
12         * @param {number} restaurantId The restaurant ID
13         * @param {function} successCallback Function to call on success
14         * @param {function} errorCallback Function to call on error
15         */
16        getRestaurantDiningInfo: function(restaurantId, successCallback, errorCallback) {
17            $.ajax({
18                url: fanaticOpenTable.ajaxUrl,
19                type: 'GET',
20                data: {
21                    action: 'fanatic_opentable_get_restaurant_dining_info',
22                    security: fanaticOpenTable.nonce,
23                    restaurant_id: restaurantId
24                },
25                success: function(response) {
26                    if (response.success) {
27                        successCallback(response.data);
28                    } else {
29                        errorCallback(response.data.message);
30                    }
31                },
32                error: function(xhr, status, error) {
33                    errorCallback(error);
34                }
35            });
36        },
37        
38        /**
39         * Get restaurant availability
40         * 
41         * @param {object} params Parameters for the availability request
42         * @param {function} successCallback Function to call on success
43         * @param {function} errorCallback Function to call on error
44         */
45        getAvailability: function(params, successCallback, errorCallback) {
46            $.ajax({
47                url: fanaticOpenTable.ajaxUrl,
48                type: 'GET',
49                data: $.extend({
50                    action: 'fanatic_opentable_get_availability',
51                    security: fanaticOpenTable.nonce
52                }, params),
53                success: function(response) {
54                    if (response.success) {
55                        successCallback(response.data);
56                    } else {
57                        errorCallback(response.data.message);
58                    }
59                },
60                error: function(xhr, status, error) {
61                    errorCallback(error);
62                }
63            });
64        },
65        
66        /**
67         * Reserve a slot (place a temporary hold)
68         * 
69         * @param {object} reservationData Reservation data
70         * @param {function} successCallback Function to call on success
71         * @param {function} errorCallback Function to call on error
72         */
73        reserveSlot: function(reservationData, successCallback, errorCallback) {
74            $.ajax({
75                url: fanaticOpenTable.ajaxUrl,
76                type: 'POST',
77                data: $.extend({
78                    action: 'fanatic_opentable_reserve_slot',
79                    security: fanaticOpenTable.nonce
80                }, reservationData),
81                success: function(response) {
82                    if (response.success) {
83                        successCallback(response.data);
84                    } else {
85                        errorCallback(response.data.message);
86                    }
87                },
88                error: function(xhr, status, error) {
89                    errorCallback(error);
90                }
91            });
92        },
93        
94        /**
95         * Confirm a reservation
96         * 
97         * @param {object} reservationData Reservation data
98         * @param {function} successCallback Function to call on success
99         * @param {function} errorCallback Function to call on error (receives message and code)
100         */
101        confirmReservation: function(reservationData, successCallback, errorCallback) {
102            $.ajax({
103                url: fanaticOpenTable.ajaxUrl,
104                type: 'POST',
105                data: $.extend({
106                    action: 'fanatic_opentable_confirm_reservation',
107                    security: fanaticOpenTable.nonce
108                }, reservationData),
109                success: function(response) {
110                    if (response.success) {
111                        successCallback(response.data);
112                    } else {
113                        errorCallback(response.data && response.data.message ? response.data.message : 'Unknown error', response.data && response.data.code ? response.data.code : null);
114                    }
115                },
116                error: function(xhr, status, error) {
117                    // Try to parse the response body for error details
118                    try {
119                        var response = JSON.parse(xhr.responseText);
120                        if (response.data && response.data.message) {
121                            errorCallback(response.data.message, response.data.code || null);
122                            return;
123                        }
124                    } catch(e) {
125                        // If parsing fails, fall through to generic error
126                    }
127                    errorCallback(error || 'Unknown error occurred', null);
128                }
129            });
130        },
131        
132        /**
133         * Get reservation details by confirmation number
134         * 
135         * @param {object} reservationData Reservation lookup data
136         * @param {function} successCallback Function to call on success
137         * @param {function} errorCallback Function to call on error
138         */
139        getReservationDetails: function(reservationData, successCallback, errorCallback) {
140            $.ajax({
141                url: fanaticOpenTable.ajaxUrl,
142                type: 'POST',
143                data: $.extend({
144                    action: 'fanatic_opentable_get_reservation_details',
145                    security: fanaticOpenTable.nonce
146                }, reservationData),
147                success: function(response) {
148                    if (response.success) {
149                        successCallback(response.data);
150                    } else {
151                        errorCallback(response.data.message);
152                    }
153                },
154                error: function(xhr, status, error) {
155                    errorCallback(error);
156                }
157            });
158        }
159    };
160    
161    // Make the API available globally
162    window.FanaticOpenTableAPI = OpenTableAPI;
163    
164})(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.