var environmentSettingsConfig = this.environmentSettingsConfig || {}; environmentSettingsConfig.AdminJavaScriptShortDateFormat = 'dd/MM/yyyy'; environmentSettingsConfig.AdminDateFormat = 'dd/MM/yyyy'; environmentSettingsConfig.PublicJavaScriptShortDateFormat = "dd/MM/yyyy"; environmentSettingsConfig.CurrentVenueIanaTimeZone = 'Europe/London'; environmentSettingsConfig.CurrentLocale = 'en-GB'; environmentSettingsConfig.CurrentVenueUrlSegment = 'SkiptonCricketClub'; environmentSettingsConfig.ErrorsVerboseConsole = false; environmentSettingsConfig.ErrorsVerboseHtml = false; environmentSettingsConfig.FacebookAppID = 'not-set'; environmentSettingsConfig.Genders = [{"Text":"Male","Value":0},{"Text":"Female","Value":1}]; environmentSettingsConfig.GlobalDomain = 'clubspark.net'; environmentSettingsConfig.GlobalFeatures = { "Version": 638671793744987400, "DefaultModules": { "Venues": true, "CoachingOrganisations": true, "Regions": false, "Authorities": true }, "Account": { "UserPhoneNumberIsRequired": false, "PasswordlessSignInEnabled": false, "HideGlobalRegistrationLink": false, "AccountMerge": false, "SocialAccountMerge": false, "AccountMergeEnabled": false, "EnableStripeExpressOnboarding": false }, "Booking": { "AdminOnlyBookingSheetColours": false, "AppPromo": false, "CheckInContacts": false, "NewDayBookingAvailabilityTime": true, "NoShowCharges": false, "ResourceFormat": false, "ResponsibilityCategory": false, "SessionMaxBookingSlots": false, "CourtProperties": false, "CalendarEntry": true, "MembershipRequired": false, "ResourceCategories": true, "HideResourceLighting": false, "HideResourceSurface": false, "BookingEngineV2": false, "EnableGroupBooking": true, "OffloadBulkUpdates": false, "BookingReminderEmails": true }, "Membership": { "DisableInstallments": false, "DirectDebitPayment": true, "CreditCardPayment": true, "DisableGiftAidOption": true, "GuardianMandatory": true, "AutoPaymentDateOfPurchasePackages": false, "AutoPaymentFixedDatePackages": false, "NewMembershipRegistrationProcess": true, "GetGoCardlessVerificationStatus": true, "RestrictMemberImport": false, "MembershipAddons": true, "PauseMembership": false, "ChangeInstalmentCost": false }, "Coaching": { "OptimisedSearch": true, "RunningFields": false, "CoachingTeam": true, "CoachingReports": true, "DelayParticipantOrders": false, "DelayCoachOrders": false, "RecurringSessions": true, "MembershipRequired": false, "EnqueueBookings": false, "EnableSchemeSearchFilter": false, "EnableThemeSearchFilter": false, "EnableBookingOpeningTimeRestrictedSchemeFeature": true, "OfflineCoachingPayments": true, "Lessons": false, "EnableBookingCourtInProgramming": false, "DisableAddCategory": false, "EnableResources": false, "OneOffCourseFeatures": { "BulkDiscountsEnabled": false, "MultipleSessionsEnabled": false, "CreateSessionsAutomatically": true, "PublishToPlayTennisAu": false }, "SeriesFeatures": { "BulkDiscountsEnabled": false, "MultipleSessionsEnabled": true, "CreateSessionsAutomatically": true, "PublishToPlayTennisAu": true }, "OpenCourtSessionsLive": false, "EnableThemeForCustomCourses": false, "EnableCancellationWindowForCourses": true, "CoachingRegisterAdministrator": true, "ArchiveCategories": true, "EnableCoachingReminderEmails": true, "DisablePrefixForSchemeNames": false, "EnableElasticSearchCoaching": false, "EnableAdministratorSchemeSessionsV2": true, "EnableElasticSearchCamps": false, "WaitingList": true }, "Competition": { "UsePersonExternalID": true, "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, "ContactLookupsV3": true, "ContactLookupsV3_VenueAdminContacts_Print": true, "ContactLookupsV3_VenueAdminContacts_Export": true, "ContactLookupsV3_VenueAdminContacts_Lookup": true, "ContactLookupsV3_VenueAdminContacts_Delete": false, "ContactLookupsV3_VenueAdminContacts_Recipients": false, "ContactLookupsV3_VenueAdminMembership_Lookup": false, "ContactLookupsV3_VenueAdminMembership_Export": false, "ContactLookupsV3_VenueAdminMembership_Print": false, "ContactLookupsV3_VenueAdminMembership_Move": false, "ContactLookupsV3_VenueAdminMembership_Recipients": false, "ContactLookupsV3_VenueAdminMembership_ChangeCosts": false, "ContactLookupsV3_VenueAdminMembership_RequestPayment": false, "ContactLookupsV3_Api_SendEmails": false, "ContactLookupsV3_Api_VenueContacts_Lookup": true, "ContactLookupsV3_Handler_MembershipPackage": false, "ContactLookupsV3_Handler_MembershipRenewalRequests": false, "ContactLookupsV3_Handler_AddTagsToVenueContacts": false, "ContactLookupsV3_Handler_DeleteTagsFromVenueContacts": false, "ContactLookupsV3_Compare": false, "ContactForm": true, "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": true }, "Website": { "Multilingual": false, "NoCoachingCourseSearch": false, "NoSubPages": false, "SectionHeros": true, "ConsentsOptOutByDefault": true, "VenueConsentsOptOutByDefault": true, "GuardianMandatory": true, "Activation": false, "EnableClassificationLogoImages": false, "PasswordConfirmation": false, "AcceptPrivacyPolicyOnRegister": false, "NewLocationsLookup": false, "Appcues": true, "FooterNavigation": false, "Affiliations": false, "DisableVenues": false, "ActivityVideosWebpage": false, "MyGameNavigation": true, "MoreCustomPages": true, "MembersOnlyPages": true, "GoogleAnalytics": true, "Favicons": true, "MorePartnerLogos": true, "Calendar": false, "FontSelection": true, "NavigationSelection": false, "EnableCovid19Notice": false }, "DiscountsAndCredits": { "CoachingCredits": true, "BookingCredits": true }, "Payments": { "PaymentReports": true, "MultipleStripeAccounts": true, "CreatePayment": true } }; environmentSettingsConfig.Partner = 'solo'; environmentSettingsConfig.PortalUrlSegment = 'ServeControl'; environmentSettingsConfig.ShortDateFormat = 'dd/MM/yyyy'; environmentSettingsConfig.ShortTimeFormat = 'HH:mm'; environmentSettingsConfig.StripeExpressKey = 'pk_live_N3Cu88jt4Y8nPuIhkvGJpzzO'; environmentSettingsConfig.StripeKey = 'pk_live_N3Cu88jt4Y8nPuIhkvGJpzzO'; 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-9999-0000-0000-000000000000'; environmentSettingsConfig.VenueMode = window.location.hostname == environmentSettingsConfig.GlobalDomain ? 'subdirectory' : 'domain'; environmentSettingsConfig.AppSettings = { "Account" : { "List" : { }, "Content" : { }, "Setting" : { "EnableRelatedPlayerVenueConsents" : "", } }, "Booking" : { "Content" : { "BookingLower" : "booking", "BookingUpper" : "Booking", "BookingsLower" : "bookings", "BookingsUpper" : "Bookings", "CourtUpper" : "Resource", "CourtsLower" : "resources", }, "Setting" : { } }, "Coaching" : { "Content" : { "CoachingUpper" : "Coaching", }, "Dictionary" : { }, "Enum" : { }, "List" : { }, "Setting" : { "UtrRatingMax" : "16.5", "UtrRatingMin" : "1", }, "FA" : { }, "ECB" : { } }, "Contacts" : { "Content" : { }, "List" : { }, "Setting" : { } }, "Checklists" : { "Settings" : { } }, "Dbs" : { "Settings" : { } }, "Events" : { "Content" : { }, "Setting" : { } }, "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" : { "EmailAddress" : "", "PersonName" : "^[a-zA-ZÀ-ÖÙ-öù-ÿA-ž?-?\\-\\\u0027\\\u0026\\ \\.]+$", "PhoneNumber" : "^\\s*\\+?\\s*([0-9][\\s-]*){7,}$", "Postcode" : "^[a-zA-Z0-9][a-zA-Z0-9\\- ]{0,10}[a-zA-Z0-9]$" }, "Setting" : { "AdminJavaScriptDateZebraDatePickerFormat" : "Y-m-d", "DisableOrderCancellation" : "", "JavaScriptTimeFormat" : "HH:mm:ss", "MinimumUserAge" : "13", "MomentJsLongDateFormat" : "llll", "MomentJsMediumDateFormat" : "D MMM YYYY", "MomentJsShortDateFormat" : "DD/MM/YYYY", } }, "Membership" : { "Content" : { }, "Setting" : { } }, "Venue" : { "Data" : { } }, "Localisation" : { }, "Payments" : { "Content" : { }, "Setting" : { "CurrencyCode" : "GBP", "CurrencySymbol" : "£", "OrdersAllowCancellation" : "false", "OrdersAllowDeliveryAddressEditing" : "false" } }, "Reporting" : { "Setting" : { } }, "Tournaments" : { "Content" : { }, "Setting" : { } }, "WebsiteManager" : { "Content" : { }, "Setting" : { } }, "GlobalFeatures" : { "DefaultModules" : { }, "Account" : { }, "Competition" : { }, "Booking" : { }, "Coaching" : { }, "Membership" : { }, "Events" : { }, "Contacts" : { }, "Venue" : { }, "Website" : { } }, "VenueProfile" : { "Content" : { }, "Setting" : { } }, "Content" : { "Booking" : { }, "Classification" : { }, "Coaching" : { }, "Common" : { }, "Emails" : { }, "GlobalFeatures" : { }, "Home" : { }, "RegularExpressions" : { }, "Terms" : { }, "Venue" : { }, "Region" : { }, "Events" : { }, "MembershipEmails" : { }, "AdminWebsite" : { }, "SchemesEmails" : { }, "Tournaments" : { }, "AddPlayer" : { } } }; environmentSettingsConfig.AppSettings = { "Account" : { "List" : { }, "Content" : { }, "Setting" : { "EnableRelatedPlayerVenueConsents" : "", } }, "Booking" : { "Content" : { "BookingLower" : "booking", "BookingUpper" : "Booking", "BookingsLower" : "bookings", "BookingsUpper" : "Bookings", "CourtUpper" : "Resource", "CourtsLower" : "resources", }, "Setting" : { } }, "Coaching" : { "Content" : { "CoachingUpper" : "Coaching", }, "Dictionary" : { }, "Enum" : { }, "List" : { }, "Setting" : { "UtrRatingMax" : "16.5", "UtrRatingMin" : "1", }, "FA" : { }, "ECB" : { } }, "Contacts" : { "Content" : { }, "List" : { }, "Setting" : { } }, "Checklists" : { "Settings" : { } }, "Dbs" : { "Settings" : { } }, "Events" : { "Content" : { }, "Setting" : { } }, "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" : { "EmailAddress" : "", "PersonName" : "^[a-zA-ZÀ-ÖÙ-öù-ÿA-ž?-?\\-\\\u0027\\\u0026\\ \\.]+$", "PhoneNumber" : "^\\s*\\+?\\s*([0-9][\\s-]*){7,}$", "Postcode" : "^[a-zA-Z0-9][a-zA-Z0-9\\- ]{0,10}[a-zA-Z0-9]$" }, "Setting" : { "AdminJavaScriptDateZebraDatePickerFormat" : "Y-m-d", "DisableOrderCancellation" : "", "JavaScriptTimeFormat" : "HH:mm:ss", "MinimumUserAge" : "13", "MomentJsLongDateFormat" : "llll", "MomentJsMediumDateFormat" : "D MMM YYYY", "MomentJsShortDateFormat" : "DD/MM/YYYY", } }, "Membership" : { "Content" : { }, "Setting" : { } }, "Venue" : { "Data" : { } }, "Localisation" : { }, "Payments" : { "Content" : { }, "Setting" : { "CurrencyCode" : "GBP", "CurrencySymbol" : "£", "OrdersAllowCancellation" : "false", "OrdersAllowDeliveryAddressEditing" : "false" } }, "Reporting" : { "Setting" : { } }, "Tournaments" : { "Content" : { }, "Setting" : { } }, "WebsiteManager" : { "Content" : { }, "Setting" : { } }, "GlobalFeatures" : { "DefaultModules" : { }, "Account" : { }, "Competition" : { }, "Booking" : { }, "Coaching" : { }, "Membership" : { }, "Events" : { }, "Contacts" : { }, "Venue" : { }, "Website" : { } }, "VenueProfile" : { "Content" : { }, "Setting" : { } }, "Content" : { "Booking" : { }, "Classification" : { }, "Coaching" : { }, "Common" : { }, "Emails" : { }, "GlobalFeatures" : { }, "Home" : { }, "RegularExpressions" : { }, "Terms" : { }, "Venue" : { }, "Region" : { }, "Events" : { }, "MembershipEmails" : { }, "AdminWebsite" : { }, "SchemesEmails" : { }, "Tournaments" : { }, "AddPlayer" : { } } }; 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 = $('