var environmentSettingsConfig = this.environmentSettingsConfig || {}; environmentSettingsConfig.AdminJavaScriptShortDateFormat = 'dd/MM/yyyy'; environmentSettingsConfig.AdminDateFormat = 'dd/MM/yyyy'; environmentSettingsConfig.PublicJavaScriptShortDateFormat = "dd/MM/yyyy"; environmentSettingsConfig.CurrentVenueIanaTimeZone = 'Pacific/Auckland'; environmentSettingsConfig.CurrentLocale = 'en-GB'; environmentSettingsConfig.CurrentVenueUrlSegment = 'PukekoheTennisClub'; environmentSettingsConfig.ErrorsVerboseConsole = false; environmentSettingsConfig.ErrorsVerboseHtml = false; environmentSettingsConfig.FacebookAppID = '1052748581475707'; environmentSettingsConfig.Genders = [{"Text":"Male","Value":0},{"Text":"Female","Value":1}]; environmentSettingsConfig.GlobalDomain = 'clubspark.kiwi'; environmentSettingsConfig.GlobalFeatures = { "Version": 638465775277795362, "DefaultModules": { "Venues": false, "CoachingOrganisations": true, "Regions": false, "Authorities": false }, "Account": { "UserPhoneNumberIsRequired": false, "PasswordlessSignInEnabled": false, "AccountMerge": false, "SocialAccountMerge": false, "AccountMergeEnabled": false }, "Booking": { "AdminOnlyBookingSheetColours": false, "AppPromo": false, "CheckInContacts": false, "NewDayBookingAvailabilityTime": true, "NoShowCharges": false, "ResourceFormat": false, "ResponsibilityCategory": true, "SessionMaxBookingSlots": false, "CourtProperties": true, "CalendarEntry": false, "MembershipRequired": false, "ResourceCategories": false, "HideResourceLighting": false, "HideResourceSurface": false, "BookingEngineV2": false, "EnableGroupBooking": true }, "Membership": { "DisableInstallments": false, "DirectDebitPayment": false, "CreditCardPayment": true, "DisableGiftAidOption": true, "GuardianMandatory": true, "AutoPaymentDateOfPurchasePackages": false, "AutoPaymentFixedDatePackages": false, "NewMembershipRegistrationProcess": true, "GetGoCardlessVerificationStatus": false, "RestrictMemberImport": false, "MembershipAddons": true, "PauseMembership": false, "ChangeInstalmentCost": false }, "Coaching": { "OptimisedSearch": false, "RunningFields": false, "CoachingTeam": true, "CoursePaymentRequests": true, "CoachingReports": true, "SessionPaymentRequests": true, "TennisForKidsLive": false, "DelayParticipantOrders": false, "DelayCoachOrders": false, "RecurringSessions": true, "MembershipRequired": false, "EnqueueBookings": false, "EnableSchemeSearchFilter": false, "EnableThemeSearchFilter": false, "EnableBookingOpeningTimeRestrictedSchemeFeature": true, "OfflineCoachingPayments": true, "JuniorSafePlay": true, "AdultSafePlay": false, "Lessons": true, "EnableBookingCourtInProgramming": false, "DisableAddCategory": false, "EnableResources": false, "OneOffCourseFeatures": { "BulkDiscountsEnabled": true, "MultipleSessionsEnabled": false, "CreateSessionsAutomatically": true, "PublishToPlayTennisAu": false }, "SeriesFeatures": { "BulkDiscountsEnabled": true, "MultipleSessionsEnabled": true, "CreateSessionsAutomatically": true, "PublishToPlayTennisAu": true }, "OpenCourtSessionsLive": false, "EnableThemeForCustomCourses": false, "EnableCancellationWindowForCourses": false, "CoachingRegisterAdministrator": true, "ArchiveCategories": true, "EnableElasticSearchCoaching": true, "EnableElasticSearchCamps": true, "WaitingList": false }, "Competition": { "SocialLeagues": false, "UsePersonExternalID": false, "BulkPaymentRequests": false, "DisableRefereeSearch": false, "DisableTournamentDirectorSearch": false, "HideLevelNames": false }, "Contacts": { "Bios": false, "Photos": false, "Social": false, "Mentors": false, "Delete": true, "Unsubscribe": true, "RestrictUnregistered": false, "EmailAttachments": true, "VenueContactRelationships": true, "BulkDeleteContacts": true, "ContactLookupsV2": true, "ContactForm": false, "LockPersonalDetailsWhenUserConnected": false, "ContactNotes": true }, "Venue": { "DeliveryAddress": false, "PrivacyPolicy": true, "SocialAccountsDisabled": false, "CanEditJuniorAge": true, "SubDomainCreation": false, "Facilities": false, "AddTraditionalLocation": false, "AddNonTraditionalLocation": false, "LinkedLocations": false, "Waiver": true, "MultiBookingSheets": false }, "Website": { "Multilingual": false, "NoCoachingCourseSearch": false, "NoSubPages": false, "SectionHeros": true, "ConsentsOptOutByDefault": true, "VenueConsentsOptOutByDefault": true, "GuardianMandatory": true, "Activation": false, "NationalCourtBookingLive": false, "EnableClassificationLogoImages": false, "PasswordConfirmation": false, "AcceptPrivacyPolicyOnRegister": false, "NewLocationsLookup": false, "Appcues": true, "FooterNavigation": false, "Affiliations": false, "DisableVenues": false, "ActivityVideosWebpage": false, "MyGameNavigation": false, "MoreCustomPages": true, "MembersOnlyPages": true, "GoogleAnalytics": true, "Favicons": true, "MorePartnerLogos": true, "Calendar": false, "FontSelection": true, "NavigationSelection": false }, "Events": { "GBTWAccess": false, "CustomEventName": true }, "DiscountsAndCredits": { "CoachingCredits": true, "BookingCredits": true }, "Payments": { "PaymentReports": false, "MultipleStripeAccounts": true } }; environmentSettingsConfig.Partner = 'solo'; environmentSettingsConfig.PortalUrlSegment = 'portal'; environmentSettingsConfig.ShortDateFormat = 'dd/MM/yyyy'; environmentSettingsConfig.ShortTimeFormat = 'HH:mm'; environmentSettingsConfig.StripeExpressKey = 'pk_live_CJZJoKS8IoGLJtcxZPkKhuY0'; environmentSettingsConfig.StripeKey = 'pk_live_CJZJoKS8IoGLJtcxZPkKhuY0'; environmentSettingsConfig.SubCategorySessions = [{"sessionId":2010,"name":"Adult"},{"sessionId":2020,"name":"Junior"},{"sessionId":2030,"name":"Mini"},{"sessionId":2040,"name":"Individual"},{"sessionId":2050,"name":"Disability"},{"sessionId":2060,"name":"Holiday Camps"},{"sessionId":2990,"name":"Other"},{"sessionId":3010,"name":"Sanctioned Tournament"},{"sessionId":3020,"name":"Event"},{"sessionId":3030,"name":"League Fixture"},{"sessionId":3040,"name":"Fun Tournament"},{"sessionId":3990,"name":"Other"},{"sessionId":4010,"name":"Team Practice"},{"sessionId":4020,"name":"Club Night"},{"sessionId":4990,"name":"Other"},{"sessionId":5010,"name":"LTA Event"},{"sessionId":5020,"name":"LTA Coaching Qualification"},{"sessionId":5030,"name":"Non-venue Event/Tournament"},{"sessionId":5990,"name":"Other"}]; environmentSettingsConfig.TenantID = '00000001-1003-0000-0000-000000000000'; environmentSettingsConfig.VenueMode = window.location.hostname == environmentSettingsConfig.GlobalDomain ? 'subdirectory' : 'domain'; environmentSettingsConfig.AppSettings = { "Account" : { "List" : { }, "Content" : { }, "Setting" : { } }, "Booking" : { "Content" : { "BookingLower" : "booking", "BookingUpper" : "Booking", "BookingsLower" : "bookings", "BookingsUpper" : "Bookings", "CourtUpper" : "Resource", "CourtsLower" : "resources", }, "Setting" : { } }, "Coaching" : { "Content" : { "CoachingUpper" : "Coaching", }, "Enum" : { }, "List" : { }, "Setting" : { "UtrRatingMax" : "16.5", "UtrRatingMin" : "1", } }, "Contacts" : { "Content" : { }, "List" : { }, "Setting" : { } }, "Events" : { "Content" : { } }, "Global" : { "Content" : { "ChequeLabel" : "Cheque", "ColourLabel" : "Colour", "DocumentRegion" : "uk", "GuardianUpper" : "Guardian", "OrganisationLower" : "venue", "PlatformCountryRestriction" : "uk", "PlatformLat" : "53.55", "PlatformLng" : "-2.36967", "PlatformName" : "ClubSpark", "PlatformZoom" : "5", "PostcodeLabel" : "Postcode", }, "Dictionary" : { }, "Enum" : { }, "List" : { }, "Regex" : { "PersonName" : "^[a-zA-ZÀ-ÖÙ-öù-ÿA-ž?-?\\-\\\u0027\\\u0026\\ \\.]+$", "PhoneNumber" : "^[0-9]{9,11}$", "Postcode" : "^[0-9]{4}$" }, "Setting" : { "AdminJavaScriptDateZebraDatePickerFormat" : "Y-m-d", "JavaScriptTimeFormat" : "HH:mm:ss", "MinimumUserAge" : "13", "MomentJsLongDateFormat" : "llll", "MomentJsMediumDateFormat" : "D MMM YYYY", "MomentJsShortDateFormat" : "DD/MM/YYYY", } }, "Membership" : { "Content" : { } }, "Localisation" : { }, "Payments" : { "Content" : { }, "Setting" : { "CurrencyCode" : "NZD", "CurrencySymbol" : "$", } }, "Reporting" : { "Setting" : { } }, "Tournaments" : { "Content" : { }, "Setting" : { } }, "WebsiteManager" : { "Content" : { } }, "GlobalFeatures" : { "DefaultModules" : { }, "Account" : { }, "Competition" : { }, "Booking" : { }, "Coaching" : { }, "Membership" : { }, "Events" : { }, "Contacts" : { }, "Venue" : { }, "Website" : { } } }; var AuthHandler = function(config) { var cache; var redirectUrl = config.zoneRoot + 'oauth2-redirect.html'; var authorizeUrl = config.authRoot + 'issue/oauth2/authorize'; this.withToken = function (args) { args = args || {}; if (typeof args === "function") args = { success: args }; args.success = args.success || function() {}; args.error = args.error || function() {}; args.scope = args.scope || "token"; /* Attempt to load the current oauth token from localStorage */ /* var tokenCache = localStorage.getItem('oauth2.token'); */ var tokenCache = cache; var adminToken = null; if (tokenCache != null) adminToken = JSON.parse(tokenCache); var now = Math.floor(Date.now() / 1000); /* If token expires within next 60 seconds, we'll request a new one anyways */ if (adminToken != null && adminToken.expires_after < now + 60) adminToken = null; if (adminToken == null) { window.addEventListener('message', function (event) { if (event.data.action == 'oauth2.callback') { if (event.data.isValid) { var token = { expires_after: now + event.data.expires_in, access_token: event.data.access_token }; /* Store the token in cache */ /* localStorage.setItem('oauth2.token', JSON.stringify(token)); */ cache = JSON.stringify(token); args.success(token.access_token); } else { args.error(event.data); } } }, { once: true, capture: false }); var nonce = btoa(Date.now()); var authorizePayload = { tokenType: 'csa', response_type: 'token', client_id: 'clubspark-ui', redirect_uri: redirectUrl, scope: config.scopeRoot + args.scope, state: nonce, realm: config.webRoot, }; var implicitUrl = authorizeUrl + '?' + $.param(authorizePayload); /* Get iframe for sso */ var iframe = $('iframe[name="oauth2"]'); if (iframe.length == 0) { iframe = $('