Skip to content

Instantly share code, notes, and snippets.

@ethanhinson
Last active February 13, 2019 17:06
Show Gist options
  • Save ethanhinson/dbfeaf47426fb04d7deffe149c366cd9 to your computer and use it in GitHub Desktop.
Save ethanhinson/dbfeaf47426fb04d7deffe149c366cd9 to your computer and use it in GitHub Desktop.
Hub Options Data Structure
{
"settings": {
"ldrc": {
/// Stuff
},
"components": {
"MyComponent": {
/// Stuff
}
}
},
"realms" : [
{
"name": "quick_search",
"settings": {
"ldrc": {
/// Stuff
},
"components": {
"MyComponent": {
/// Stuff
}
}
}
}
]
}
@tanmancan
Copy link

tanmancan commented Jan 28, 2019

Current working JSON config:

{
    "folder": "sunriverresort",
    "elements":
    {
        "AvailContainer": "app",
        "DetailsPageContainer": "details-page"
    },
    "guid": "5c51d49497bbb",
    "opts":
    {
        "showCustomCategories": true,
        "AvailContainer":
        {
            "showMap": false,
            "children":
            {
                "SearchProvider":
                {
                    "endpoint": "https://blueprint.rezfusion.com/graphql",
                    "channels": "https://www.destinationhotels.com/sunriver-resort",
                    "itemDetailsPath": "/sunriver-resort/oregon-vacation-rentals/vacation-rentals",
                    "children":
                    {
                        "AvailabilityConsumer":
                        {
                            "options":
                            {
                                "showAdultsChildren": false,
                                "minAdvance": 2,
                                "maxAdvance": 361,
                                "increment": 1,
                                "turnDays": [],
                                "maxStay": 28
                            }
                        },
                        "Map":
                        {
                            "id": "result-map",
                            "className": "bt-result-map",
                            "apiKey": "AIzaSyBVjELQFFgP5_gCE_H_0FIjATj1fxugwoE",
                            "options":
                            {
                                "center":
                                {
                                    "lat": 36.035843,
                                    "lng": -75.631894
                                },
                                "zoom": 8
                            }
                        }
                    }
                }
            }
        },
        "DetailsPageContainer":
        {
            "children":
            {
                "SearchProvider":
                {
                    "endpoint": "https://blueprint.rezfusion.com/graphql",
                    "channels": "https://www.destinationhotels.com/sunriver-resort",
                    "children":
                    {
                        "DetailsPage":
                        {
                            "endpoint": "https://blueprint.rezfusion.com/graphql",
                            "channels": "https://www.destinationhotels.com/sunriver-resort",
                            "children":
                            {
                                "QuoteList":
                                {
                                    "buttons":
                                    {
                                        "book": "Book Now",
                                        "quote": "Detailed Quote"
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}

@tanmancan
Copy link

tanmancan commented Jan 28, 2019

Updated config with comments:

const options = {
    settings: {
        /**
         * Storage folder name within S3 bucket.
         * Should be unique and autogenerated per channel.
         *
         * @required
         * @type {String}
         */
        folder: 'sunriverwebsite',
        /**
         * Company GUID.
         * Entered during creating and editing an organization.
         * Will automatically get pulled into options.
         *
         * @required
         * @type {String}
         */
        guid: 'install7',
        /**
         * Global component options.
         * These can be overriden via realms.
         *
         * @type {Object}
         */
        components: {
            /**
             * SearchProvider options
             * @type {Object}
             */
            SearchProvider: {
                /**
                 * Search API Endpoint
                 *
                 * @required
                 * @type {String}
                 */
                endpoint: "http://localhost:3000/graphql",
                /**
                 * Channel URL
                 * Used to search a specific channel
                 *
                 * @required
                 * @type {String}
                 */
                channels: "https://sunriverwebsite.com",
                /**
                 * Override Default Search Query
                 * Provide graphql query to override default search.
                 *
                 * @optional
                 * @type {String}
                 */
                query: '',
                /**
                 * Default Result Sorting
                 *
                 * Default sorting for search result
                 *
                 * @optional
                 * @type {String}
                 */
                sort: 'random',
                /**
                 * Use custom categories, instead of
                 * categories provided by property management software.
                 *
                 * @required
                 * @type { Bool }
                 */
                showCustomCategories: false,
            },
            /**
             * Search Settings
             *
             * @type {Object}
             */
            AvailabilitySearchConsumer: {
                /**
                 * Secure Payment Server Domain
                 *
                 * Enter the URL for the secure payment server.
                 *
                 * @required
                 * @type {String}
                 */
                spsDomain: 'https://sps.stg.rescmshost.com/sps/book',
                /**
                 * Show Adults and Children
                 *
                 * @todo Better helptext
                 *
                 * @optional
                 * @type {Boolean}
                 */
                showAdultsChildren: false,
                /**
                 * Show flexible Search Option
                 *
                 * @todo  Better helptext
                 *
                 * @optional
                 * @type {Boolean}
                 */
                showFlex: false,
                /**
                 * Set the maximum allowable adults.
                 *
                 * @todo  Better helptext
                 *
                 * @optional
                 * @type {Number}
                 */
                maxAdults: 0,
                /**
                 * Set the maximum allowable children.
                 *
                 * @todo  Better helptext
                 *
                 * @optional
                 * @type {Number}
                 */
                maxChildren: 0,
                /**
                 * Select the default date format to be used in date entry fields and popup datepickers.
                 *
                 * @todo  What should this default be?
                 *
                 * @type {String}
                 */
                dateFormat: '',
                /**
                 * Minimum Stay
                 * Enter a number from 1 to 30. Specify the minimum stay length.
                 * This will restrict the users to selecting date ranges
                 * of at least the specified number of days in availability searches.
                 *
                 * @optional
                 * @type {Number}
                 */
                minStay: 0,
                /**
                 * Maximum Stay
                 * Enter a number from 1 to 730. Specify the maximum advanced booking.
                 * This will restrict the users to selecting departure
                 * dates at most the specified number of days advance.
                 *
                 * @optional
                 * @type {Number}
                 */
                maxStay: 28,
                /**
                 * ?
                 *
                 * @todo  Better helptext
                 *
                 * @optional
                 * @type {Number}
                 */
                increment: 7,
                /**
                 * Turn Days
                 * Choose which days to allow check-ins
                 *
                 * 1 - Sunday
                 * 2 - Monday
                 * ...
                 * 7 - Saturday
                 *
                 * @optional
                 * @type {Array}
                 */
                turnDays: [1, 6, 7],
                /**
                 * Minimum Advanced Booking
                 * Enter a number from 0 to 30. Specify the minimum advanced booking.
                 * This will restrict the users to selecting arrival dates
                 * at least the specified number of days advance.
                 *
                 * @optional
                 * @type {Number}
                 */
                minAdvance: 2,
                /**
                 * Maximum Advanced Booking
                 * Enter a number from 1 to 730. Specify the maximum advanced booking.
                 * This will restrict the users to selecting departure dates
                 * at most the specified number of days advance.
                 *
                 * @optional
                 * @type {Number}
                 */
                maxAdvance: 361,
                /**
                 * Show Nightly Prices
                 *
                 * @todo Better helptext
                 *
                 * @optional
                 * @type {Boolean}
                 */
                showNightlyPrices: true,
                /**
                 * Required Prices
                 *
                 * @todo Better helptext
                 *
                 * @required
                 * @type {Boolean}
                 */
                requirePrices: true,
            },
            /**
             * AvailContainer component options
             *
             * @type {Object}
             */
            AvailContainer: {
                /**
                 * Enter Search Component Container ID
                 * ID of the element to attach the search component
                 * @type {String}
                 */
                id: 'app',
            },
            /**
             * DetailsPageContainer component options
             * @type {Object}
             */
            DetailsPageContainer: {
                /**
                 * Enter Details Page Container ID
                 * ID of the element to attach the details page component
                 * @type {String}
                 */
                id: 'details-page'
            },
            /**
             * Teaser component options
             *
             * @type {Object}
             */
            Teaser: {
                /**
                 * Item details URL
                 * Enter url for the items details page.
                 *
                 * @type {String}
                 */
                itemDetailsPath: '/details.html',
            },
            Map: {
                /**
                 * Map element ID
                 * Enter ID to attach to the map element.
                 *
                 * @todo Needs description
                 *
                 * @required
                 * @type {String}
                 */
                id: 'result-map',
                /**
                 * ?
                 * @todo can't find where this is being used. Maybe remove?
                 *
                 * @todo Needs description
                 *
                 * @required
                 * @type {String}
                 */
                className: 'bt-result-map',
                /**
                 * Google Maps api key
                 *
                 * @required
                 * @type {String}
                 */
                apiKey: '',
                /**
                 * Map configuration
                 *
                 * @type {Object}
                 */
                options: {
                    /**
                     * Default location to center the map.
                     *
                     * @type {Object}
                     */
                    center: {
                        /**
                         * Lattitude for center location
                         *
                         * @type {Number}
                         */
                        lat: 0,
                        /**
                         * Longitude for center location
                         *
                         * @type {Number}
                         */
                        lng: 0,
                    },
                    /**
                     * Default map zoom
                     * The initial resolution at which to display the map is set by the zoom property,
                     * where zoom 0 corresponds to a map of the Earth fully zoomed out,
                     * and larger zoom levels zoom in at a higher resolution. Specify zoom level as an integer.
                     *
                     * @type {Number}
                     */
                    zoom: 8,
                },
            },
            /**
             * QuoteList component options
             * @type {Object}
             */
            QuoteList: {
                /**
                 * Set labels for book now and detailed quote buttons
                 *
                 * @type {Object}
                 */
                buttons: {
                    /**
                     * Book now button lable
                     * @type {String}
                     */
                    book: 'Book Now',
                    /**
                     * Details quote button lable
                     * @type {String}
                     */
                    quote: 'Detailed Quote',
                }
            },
        }
    },
    /**
     * Realms to override default search configuration
     *
     * @type {Object}
     */
    realms: [
        /**
         * Search page realm
         *
         * @type {Object}
         */
        {
            realName: 'SearchPage',
        },
        /**
         * Details page realm
         * @type {Object}
         */
        {
            realName: 'DetailPage',
        }
    ]
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment