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 = 'HokitikaTennisClub'; 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": 638653040755192668, "DefaultModules": { "Venues": false, "CoachingOrganisations": true, "Regions": false, "Authorities": false }, "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": true, "SessionMaxBookingSlots": false, "CourtProperties": true, "CalendarEntry": false, "MembershipRequired": false, "ResourceCategories": true, "HideResourceLighting": false, "HideResourceSurface": false, "BookingEngineV2": false, "EnableGroupBooking": true, "OffloadBulkUpdates": false, "BookingReminderEmails": false }, "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": 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": 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, "EnableCoachingReminderEmails": false, "DisablePrefixForSchemeNames": false, "EnableElasticSearchCoaching": true, "EnableAdministratorSchemeSessionsV2": true, "EnableElasticSearchCamps": true, "WaitingList": false }, "Competition": { "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, "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": 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, "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, "EnableCovid19Notice": false }, "DiscountsAndCredits": { "CoachingCredits": true, "BookingCredits": true }, "Payments": { "PaymentReports": false, "MultipleStripeAccounts": true, "CreatePayment": false } }; 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" : { "EnableRelatedPlayerVenueConsents" : "", } }, "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", }, "FA" : { }, "ECB" : { } }, "Contacts" : { "Content" : { }, "List" : { }, "Setting" : { } }, "Checklists" : { "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" : "^[0-9]{9,11}$", "Postcode" : "^[0-9]{4}$" }, "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" : "NZD", "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", }, "Enum" : { }, "List" : { }, "Setting" : { "UtrRatingMax" : "16.5", "UtrRatingMin" : "1", }, "FA" : { }, "ECB" : { } }, "Contacts" : { "Content" : { }, "List" : { }, "Setting" : { } }, "Checklists" : { "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" : "^[0-9]{9,11}$", "Postcode" : "^[0-9]{4}$" }, "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" : "NZD", "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 = $('