191 lines
6.0 KiB
Go
191 lines
6.0 KiB
Go
package sravni
|
|
|
|
import (
|
|
"time"
|
|
|
|
"git.loyso.art/frx/kurious/internal/common/errors"
|
|
)
|
|
|
|
const (
|
|
ErrClientNotInited errors.SimpleError = "client was not inited"
|
|
)
|
|
|
|
type PageStateRuntimeConfig struct {
|
|
BrandingURL string `json:"brandingUrl"`
|
|
Release string `json:"release"`
|
|
Environment string `json:"environment"`
|
|
Gateway string `json:"gatewayUrl"`
|
|
APIGatewayURL string `json:"apiGatewayUrl"`
|
|
EducationURL string `json:"educationUrl"`
|
|
PhoneVerifierURL string `json:"phoneVerifierUrl"`
|
|
WebPath string `json:"webPath"`
|
|
ServiceName string `json:"serviceName"`
|
|
OrgnazationURL string `json:"organizationsUrl"`
|
|
}
|
|
|
|
type Link struct {
|
|
URL string `json:"url"`
|
|
Title string `json:"title"`
|
|
}
|
|
|
|
type ReduxStatePrefooterItem struct {
|
|
Title string `json:"title"`
|
|
Links []Link `json:"links"`
|
|
}
|
|
|
|
type ReduxMetadata struct {
|
|
Data struct {
|
|
Prefooter []ReduxStatePrefooterItem `json:"prefooter"`
|
|
} `json:"data"`
|
|
}
|
|
|
|
type field struct {
|
|
Name string `json:"name"`
|
|
Value string `json:"value"`
|
|
}
|
|
|
|
type ReduxDictionaryContainer struct {
|
|
ID string `json:"_id"`
|
|
Alias string `json:"alias"`
|
|
Name string `json:"name"`
|
|
UserID string `json:"userId"`
|
|
Created time.Time `json:"created"`
|
|
Updated time.Time `json:"updated"`
|
|
Fields []field `json:"fields"`
|
|
}
|
|
|
|
type ReduxDictionaries struct {
|
|
Data struct {
|
|
CourseThematics ReduxDictionaryContainer `json:"coursesThematics"`
|
|
LearningType ReduxDictionaryContainer `json:"learningType"`
|
|
LearningTypeSelection ReduxDictionaryContainer `json:"learningTypeSelection"`
|
|
} `json:"data"`
|
|
}
|
|
|
|
type InitialReduxState struct {
|
|
Metadata ReduxMetadata `json:"metadata"`
|
|
Dictionaries ReduxDictionaries `json:"dictionaries"`
|
|
Categories struct {
|
|
Data map[string]int `json:"data"`
|
|
} `json:"categories"`
|
|
}
|
|
|
|
type PageStateProperties struct {
|
|
InitialReduxState InitialReduxState `json:"initialReduxState"`
|
|
}
|
|
|
|
type PageState struct {
|
|
Page string `json:"page"`
|
|
Query map[string]string `json:"query"`
|
|
BuildID string `json:"buildId"`
|
|
RuntimeConfig PageStateRuntimeConfig `json:"runtimeConfig"`
|
|
Props PageStateProperties `json:"props"`
|
|
}
|
|
|
|
func (p *PageState) Clone() *PageState {
|
|
copiedState := *p
|
|
copiedState.Query = make(map[string]string, len(p.Query))
|
|
for k, v := range p.Query {
|
|
copiedState.Query[k] = v
|
|
}
|
|
|
|
data := p.Props.InitialReduxState.Categories.Data
|
|
copiedData := make(map[string]int, len(data))
|
|
for k, v := range data {
|
|
copiedData[k] = v
|
|
}
|
|
copiedState.Props.InitialReduxState.Categories.Data = copiedData
|
|
|
|
return &copiedState
|
|
}
|
|
|
|
type CourseDiscount struct {
|
|
PromoCode string `json:"promoCode"`
|
|
PromoCodeType string `json:"promoCodeType"`
|
|
Percent int `json:"percent"`
|
|
EndDate time.Time `json:"endDate"`
|
|
EndTime any `json:"endTime"`
|
|
}
|
|
|
|
type CourseAdvertising struct {
|
|
Cost float64 `json:"cost"`
|
|
ButtonText string `json:"buttonText"`
|
|
ButtonMobileText string `json:"buttonMobileText"`
|
|
IsPartner bool `json:"isPartner"`
|
|
LabelText string `json:"labelText"`
|
|
Monetization struct {
|
|
Pixels struct {
|
|
Click string `json:"click"`
|
|
Display string `json:"display"`
|
|
} `json:"pixels"`
|
|
Kind string `json:"kind"`
|
|
} `json:"monetization"`
|
|
Dialog string `json:"dialog"`
|
|
SideBarBannerText string `json:"sideBarBannerText"`
|
|
OfferHighlightColor string `json:"offerHighlightColor"`
|
|
HasOffersID string `json:"hasOffersId"`
|
|
TrackingType string `json:"trackingType"`
|
|
Token []struct {
|
|
ID string `json:"_id"`
|
|
Token []string `json:"token"`
|
|
Updated time.Time `json:"updated"`
|
|
V int `json:"__v"`
|
|
} `json:"token"`
|
|
}
|
|
|
|
type Course struct {
|
|
ID string `json:"id"`
|
|
Name string `json:"name"`
|
|
Organization string `json:"organization"`
|
|
Discount CourseDiscount `json:"discount"`
|
|
Link string `json:"link"`
|
|
Learningtype []string `json:"learningtype"`
|
|
DateStart any `json:"dateStart"`
|
|
TimeStart any `json:"timeStart"`
|
|
TimeAllHour any `json:"timeAllHour"`
|
|
TimeAllDay any `json:"timeAllDay"`
|
|
TimeAllMonth int `json:"timeAllMonth"`
|
|
IsTermApproximately bool `json:"isTermApproximately"`
|
|
DictionaryFormatFilterNew []string `json:"dictionaryFormatFilterNew"`
|
|
DictionaryLevelFilterNew []string `json:"dictionaryLevelFilterNew"`
|
|
Price int `json:"price"`
|
|
PriceAll int `json:"priceAll"`
|
|
PriceInstallment int `json:"priceInstallment"`
|
|
CourseImage string `json:"courseImage"`
|
|
WithoutDiscountPrice int `json:"withoutDiscountPrice"`
|
|
Advertising CourseAdvertising `json:"advertising"`
|
|
}
|
|
|
|
type OrganizationName struct {
|
|
Short string `json:"short"`
|
|
Full string `json:"full"`
|
|
Prepositional string `json:"prepositional"`
|
|
Genitive string `json:"genitive"`
|
|
}
|
|
|
|
type RatingsInfo struct {
|
|
ComplexCalculatedRatingValue float64 `json:"complexCalculatedRatingValue"`
|
|
ParticipantsCount int `json:"participantsCount"`
|
|
Approved int `json:"approved"`
|
|
}
|
|
|
|
type Contacts struct {
|
|
Address string `json:"address"`
|
|
Phone []string `json:"phone"`
|
|
}
|
|
|
|
type Organization struct {
|
|
ID string `json:"id"`
|
|
Alias string `json:"alias"`
|
|
License string `json:"license"`
|
|
Name OrganizationName `json:"name"`
|
|
RatingsInfo RatingsInfo `json:"ratingsInfo"`
|
|
Contacts Contacts `json:"contacts"`
|
|
Logotypes struct {
|
|
Square string `json:"square"`
|
|
Web string `json:"web"`
|
|
Android string `json:"android"`
|
|
} `json:"logotypes"`
|
|
IsLabsPartner bool `json:"isLabsPartner"`
|
|
}
|