@leaddreamer/pricingbrowser

0.1.0-beta.1 • Public • Published

view on npm

@SaltSweetSpirits/PricingBrowser

Browser functions for the Pricing as a Service system, wrapped around pricinglogic and indirectly firebase-wrapper, for the Front End.

Modules

PricingBrowser

Browser functions for the Pricing as a Service system, wrapped around pricinglogic and indirectly firebase-wrapper, for the Front End.

Browser

Browser-specific Event Services business logic and database operations

CloudCustomerPayment

Customer payment account cloud functions

CloudFunctions

Project specific Cloud functions

Commodities

Typedefs, constants, support functions and database operations related to Commodity Materials Browser Support

Fundamentals
Images

basic Redux/Database functions for images

LineItem

Typedefs, constants, support functions and database operations related to Commodity Materials Browser Support

Payment
People
Product

Typedefs, constants, support functions and database operations related to Commodity Materials Browser Support

Stages

Browser support functions for "stages" Stages are Top-level (System-wide defaults), OR User-level (individual business/craftperson defaults), OR Product=level (User selected exceptions for a particular Product)

Utilities

Utility Browser support functions

Boilerplate

Boilerplate and generic constants and functions for browser Support

Constants

Browser access and themeing constants

ReduxStore

Redux Store and State modules

FundamentalsRedux
ImagesRedux
PaymentRedux
PeopleRedux
StagesRedux
StagesActions
FundamentalsReducer
ImagesReducer
PaymentReducer
PeopleReducer
StagesReducer

PricingBrowser

Browser functions for the Pricing as a Service system, wrapped around pricinglogic and indirectly firebase-wrapper, for the Front End.

PricingBrowser.startBrowser(config) ⇒ Promise

starts the database and redux systems in the browser the client-specific firebase instance must be passed the client-specific config object must be passed Starts the database, and initiates the user authentication system Usually, but not always, started on launch

Kind: static method of PricingBrowser

Param Type
config FirebaseConfigObject

PricingBrowser~FirebaseConfigObject : object

only authDomain, databaseURL and storageBucket are present when called from a cloud environment

Kind: inner typedef of PricingBrowser
Properties

Name Type Description
apiKey string required api Key from Firebase Console,
appId string required app ID from Firebase Console
projectId string required Firebase projectID from Firebase console
authDomain string (optional) auth domain from Firebase Console
databaseURL string (optional) Firestore database URL from Firebase console
storageBucket: string (optional) URL of Firestore Storage Bucket
messagingSenderId: string (optional) ID for Messaing service from Firebase Console
measurementId: string (optional) Analytics/Measurement ID from Firebase Console
mapsAPIKey string (optional) App ID for Google Maps API, from Google

Browser

Browser-specific Event Services business logic and database operations

CloudCustomerPayment

Customer payment account cloud functions

CloudCustomerPayment.capturePaymentMethod(personId) ⇒ Promise.secret_object

Prepares to capture a payment method for a user

Kind: static method of CloudCustomerPayment
Returns: Promise.secret_object - - client secret

Param Type Description
personId string Id of person account to create customer payment account for

CloudCustomerPayment.setFanCard(personId, PDSummary) ⇒ Promise.<void>

Securely sets the particular paymentMethod as active

Kind: static method of CloudCustomerPayment

Param Type Description
personId string Id of person owning this payment
PDSummary PDSummary paymentDescriptor

CloudCustomerPayment.deleteFanCard(personId, PDSummary) ⇒ Promise.<void>

Kind: static method of CloudCustomerPayment

Param Type Description
personId string a user Id
PDSummary PDSummary paymentDescriptor of method to delete

CloudCustomerPayment~secret_object : object

Payment System "secret" for secure front-end

Kind: inner typedef of CloudCustomerPayment
Properties

Name Type
payment_secret string

CloudFunctions

Project specific Cloud functions

CloudFunctions.httpsOnCallSlipDates ⇒ Promise.boolean

Admin/Test function to push all dated object "shiftDays" forward

Kind: static constant of CloudFunctions

Param Type
shiftDays number

CloudFunctions.requestCancelPledge ⇒ Promise

Request to cancel a pledgeTicket (needs payment check)

Kind: static constant of CloudFunctions

Param Type
pledgeTicket pledgeTicketObject

CloudFunctions.authClaims(user) ⇒ Promise.Credential

fetches our specific custom claim values from user Token

Kind: static method of CloudFunctions

Param Type Description
user UserObject firebase auth user object

CloudFunctions.changeCredential(credential) ⇒ Promise.<void>

use a "credential" object to add a new server-side role to a user

Kind: static method of CloudFunctions

Param Type Description
credential Credential the new credential being requested. Verified and set at server-side

CloudFunctions.httpsOnCallCredentials(credential) ⇒ Promise

Cloud function to set credentials object

Kind: static method of CloudFunctions

Param Type
credential Credential

CloudFunctions.httpsOnCallCreateAccounts(data) ⇒ Promise.PaymentAccount

Securely creates an oganization account

Kind: static method of CloudFunctions

Param Type
data AccountRequestData

CloudFunctions.httpsOnCallOfferAccess(offer) ⇒ Promise

Cloud function for organizatin to offer user access control

Kind: static method of CloudFunctions

Param Type
offer AccessOffer

CloudFunctions.httpsOnCallCheckIn(checkin) ⇒ Promise

Cloud function to allow Organization to CheckIn a user/ticket to an event

Kind: static method of CloudFunctions

Param Type
checkin checkInObject

CloudFunctions.fixPledgeTicket(pledgeTicket) ⇒ Promise.secret_object

"Fix" a pledgeTicket - ie setup to take new payment

Kind: static method of CloudFunctions

Param Type
pledgeTicket pledgeTicketObject

CloudFunctions~Credential : object

Kind: inner typedef of CloudFunctions
Properties

Name Type Description
organization string business's Id - only one at a time
adminStatus boolean
superUser boolean
employee boolean

CloudFunctions~AccountRequestData : object

Kind: inner typedef of CloudFunctions
Properties

Name Type Description
account OrganizationType
account.type string ARTISTS, VENUES, BRANDS, CITYMANAGER or OTHER

Commodities

Typedefs, constants, support functions and database operations related to Commodity Materials Browser Support

Fundamentals

Fundamentals.ListenFundamentals() ⇒ callback

A function that returns a function to attach as a listener, that returns a function to unsubscribe This a FAKE listener - only used to load data at start-up A function that "pretends" to be a listener, to maintain consistent structure Only loads at boot-up

Kind: static method of Fundamentals

Fundamentals.ListenMCCs() ⇒ callback

A function that returns a function to attach as a listener, that returns a function to unsubscribe A function that "pretends" to be a listener, to maintain consistent structure Only loads at boot-up

Kind: static method of Fundamentals

Fundamentals.ListenBusinessTypes() ⇒ callback

A function that returns a function to attach as a listener, that returns a function to unsubscribe A function that "pretends" to be a listener, to maintain consistent structure Only loads at boot-up

Kind: static method of Fundamentals

Images

basic Redux/Database functions for images

Images.setDefaultImage() ⇒ callback

Fires off an async closure to get and set image. Could be thunk?

Kind: static method of Images

Images.setDefaultBanner() ⇒ callback

Fires off an async closure to get and set image. Could be thunk?

Kind: static method of Images

Images.setDefaultLoading() ⇒ callback

Fires off an async closure to get and set loading. Could be thunk?

Kind: static method of Images

Images.pullURLFromRecord(record, key) ⇒ Promise.string

This Utility checks if a full URL needs to be built. Image data can be => a tokenized URL, by definition public => a "private", secured URL => a filename, assumed to be stored in a structure parallel to the record path

Kind: static method of Images
Fulfil: string a "private" URL to access the file.
Reject: string

Param Type Description
record RecordObject A firestore document Record - the '/' separated collection/ document path is used as the path to the stored item.
key string An optional string identifying the specific field an stored item is associated with

Images.accessibleStorage(URL) ⇒ Promise.<URL>

This Utility checks if URL is Secured by Storage Security Rules If the URL carries an access token, it is simply returned. If the URL does NOT have an access token, it is fetched to local stoage with authentication, and a new URL created to point to the local copy.

Kind: static method of Images
Fulfil: string a local URL to access the downloaded data
Reject: string

Param Type
URL string

LineItem

Typedefs, constants, support functions and database operations related to Commodity Materials Browser Support

Payment

People

People.setClaims(newClaims) ⇒ ActionItem

Sets the various Redux states for all claims currently active

Kind: static method of People

Param Type
newClaims Credentials

People.makeActivePerson(user) ⇒ Promise

takes an authenticated user and builds the appropriate ActivePeron in the Redux store

Kind: static method of People

Param Type
user User

People.retireActivePerson() ⇒ Promise

Removes Redux records and authentication for current User

Kind: static method of People

People.ListenPerson(user) ⇒ callback

returns the unsubscribe function; will be called AT LEAST ONCE with initial document

Kind: static method of People
Returns: callback - unsubscribe function

Param Type
user User

People.savePerson(person) ⇒ Promise

Saves an (updated) PersonObject back to Database Store

Kind: static method of People

Param Type
person PersonObject

People.savePayment(person, payment_object) ⇒ Promise

Saves an (updated) PaymentObject to a specified PersonObject back to Database Store

Kind: static method of People

Param Type
person PersonObject
payment_object PaymentObject

People.CreateAnonymousFan() ⇒ Promise

calls authentication service. Listener (below) responds to status change

Kind: static method of People

People.InitAuthListener() ⇒ callback

Starts the authentication system with status listener

Kind: static method of People
Returns: callback - unsubscribe

People.signInSuccessWithAuthResult(authResult, redirectURL) ⇒ boolean

Dummt functin for auth UI. We use Async listeners to accomplish the related functions

Kind: static method of People

Param Type
authResult object
redirectURL string

Product

Typedefs, constants, support functions and database operations related to Commodity Materials Browser Support

Stages

Browser support functions for "stages" Stages are Top-level (System-wide defaults), OR User-level (individual business/craftperson defaults), OR Product=level (User selected exceptions for a particular Product)

Stages.fetchStages() ⇒ Array.Stage

Kind: static method of Stages

Stages.fetchStage(stageId) ⇒ Stage

Fetch a single Stage from the store by Id

Kind: static method of Stages

Param Type
stageId string

Stages.ListenStages(parent) ⇒ callback

Kind: static method of Stages
Returns: callback - unsubscribe function

Param Type Description
parent User | Product | null parent, if any, for the requested stages

Utilities

Utility Browser support functions

Utilities.fetchLinkedItem(type, link, refPath) ⇒ Promise.RecordDocument

used generic for constructing forms for input and display

Kind: static method of Utilities

Param Type Description
type string refers to the sub-collection name
link string refers to the linking "value" - a documentID
refPath string optionally refers to the "/" separate path to the parent document in firebase

Utilities.fetchSubItem(type, refPath) ⇒ Promise.RecordDocument

some items are stored in the database as a single-record collection, using the same Id as the parent

Kind: static method of Utilities

Param Type Description
type string refers to the sub-collection name
refPath string refers to the "/" separate path to the required parent document in firebase

Utilities.fetchType(type, refPath) ⇒ Promise.Array.RecordDocument

returns an entire sub-collection by "type" (sub-collection name). If refpath is omitted, assumes "type" is a top-level collection

Kind: static method of Utilities

Param Type Description
type string refers to the sub-collection name
refPath string optionally refers to the "/" separate path to the parent document in firebase

Utilities.selectAccountData(state, type)

parameterized selector

Kind: static method of Utilities

Param Type Description
state ReduxStore Redux State/Store
type string

Utilities.searchType(type, prompt, limit) ⇒ Promise.<HostArray>

This function is a parameterized selector

Kind: static method of Utilities
Returns: Promise.<HostArray> - - returns an array of results, up to limit

Param Type Description
type "MANAGEDARTISTS" | "MANAGEDVENUES" type of list to select. Returns {null} for others
prompt string "search" string (starts-with)
limit number limit results (from start)

Utilities.processTarget(target) ⇒ object

Generic synchronous form processing function - handles values and returns results as a keyed object

Kind: static method of Utilities

Param Type
target eventTarget

Utilities.processItemType(item, type, refPath) ⇒ Promise.RecordDocument

generic form data processing for database by "type" (collection name)

Kind: static method of Utilities

Param Type Description
item RecordDocument
type string refers to the sub-collection name
refPath string optionally refers to the "/" separate path to the parent document in firebase

Utilities.formatLinkedItem(link, type, refPath) ⇒ Promise.string

fetches a sub-record from the database and returns the result as a summary string

Kind: static method of Utilities

Param Type Description
link string refers to the linking "value" - a documentID
type string refers to the sub-collection name
refPath string refers to the "/" separate path to the required parent document in firebase

Utilities.summarizeItem(item, type) ⇒ string

parameterized function to return string summary of an object By default, returns the "name" property of the item.

Kind: static method of Utilities

Param Type Description
item object data object to summarize
type String | "People" | "Addresses" | "accessControl" - type of the object to summarize

Utilities.findIconName(url) ⇒ string

Hacky way to match Icons to urlLowerCase

Kind: static method of Utilities

Param Type
url string

Utilities.typedSortArray(type) ⇒ Array.SortObject

Firebase query support - builds default sort options

Kind: static method of Utilities

Param Type
type string

Utilities~stripDocIdFromRefPath(refPath) ⇒ string

pulls the document Id from a passed refPath string (firebase dependent)

Kind: inner method of Utilities
Returns: string - Id

Param Type
refPath string

Utilities~HostArray : ArtistFormType | VenueType

Kind: inner typedef of Utilities

Boilerplate

Boilerplate and generic constants and functions for browser Support

Boilerplate.subscriberGenerator(sliceName, tableName, filterArray, sortArray, reference, atRoot, transformer) ⇒ string

Sets up a listener, and starts it running, in the Listener Store SYNCHRONOUS

Kind: static method of Boilerplate
Returns: string - listenerStore slot key

Param Type Description
sliceName string name of "slice" of redux store to save subscribed data typeof
tableName string name of specific database table to listen to, same as Redux location to save to
filterArray Array.FilterObject
sortArray Array.SortObject
reference string path to base "tableName" from
atRoot boolean simplifies listener functions is at atRoot
transformer callback optional function to "transform" data results

Boilerplate.singleRecord(records) ⇒ Record

Some "collections" only have a signle record. This transformer simply returns the FIRST item in the collection array.

Kind: static method of Boilerplate

Param Type
records Array.Records

Boilerplate~ListenGenerator(sliceName, tableName, filterArray, sortArray, transformer) ⇒ callback

Sets up a listener for the Listener Store Assumes a CollectionGroup query

Kind: inner method of Boilerplate
Returns: callback - unsubscribe function

Param Type Default Description
sliceName string name of "slice" of redux store to save subscribed data typeof
tableName string name of specific database table to listen to, same as Redux location to save to
filterArray Array.FilterObject
sortArray Array.SortObject
transformer callback optional function to "transform" data results

Boilerplate~ListenShallowGenerator(sliceName, tableName, filterArray, sortArray, reference, transformer) ⇒ callback

Sets up a listener for the Listener Store Assumes a simple Collection query

Kind: inner method of Boilerplate
Returns: callback - unsubscribe function

Param Type Default Description
sliceName string name of "slice" of redux store to save subscribed data typeof
tableName string name of specific database table to listen to, same as Redux location to save to
filterArray Array.FilterObject
sortArray Array.SortObject
reference string path to base "tableName" from
transformer callback optional function to "transform" data results

Constants

Browser access and themeing constants

Constants.COMPANY_NAME

variable for shared Company Name

Kind: static property of Constants

Constants.TWITTER_ACCOUNT

variable for shared Twitter Name

Kind: static property of Constants

Constants.FACEBOOK_ACCOUNT

variable for shared Facebook Name

Kind: static property of Constants

Constants.INSTAGRAM_ACCOUNT

variable for shared Instagram Name

Kind: static property of Constants

Constants.LINKEDIN_ACCOUNT

variable for shared LinkedIn Name

Kind: static property of Constants

Constants.EMAIL_ACCOUNT

variable for shared Email Name

Kind: static property of Constants

Constants.PAYMENT_THEME

variable for shared Payment Name

Kind: static property of Constants

Constants.CANCELED_EVENT

Kind: static constant of Constants
Default: "Show Canceled"

Constants.UNBOOKED

Kind: static constant of Constants
Default: "unbooked"

Constants.UNBOOKED_EVENT

Kind: static constant of Constants
Default: "Tour Stop"

Constants.OPEN

Kind: static constant of Constants
Default: "open"

Constants.OPEN_OFFER

Kind: static constant of Constants
Default: "open"

Constants.WORKING

Kind: static constant of Constants
Default: "working"

Constants.WORKING_OFFER

Kind: static constant of Constants
Default: "working"

Constants.BOOKED

Kind: static constant of Constants
Default: "booked"

Constants.BOOKED_EVENT

Kind: static constant of Constants
Default: "Show"

Constants.SHOWS_EVENT

Kind: static constant of Constants
Default: "Show"

Constants.TOUR

Kind: static constant of Constants
Default: "tour"

Constants.INITIAL_SHOW_COUNT

Kind: static constant of Constants
Default: 5

Constants.NATION_ZOOM

Kind: static constant of Constants
Default: 3

Constants.REGION_ZOOM

Kind: static constant of Constants
Default: 10

Constants.VENUE_ZOOM

Kind: static constant of Constants
Default: 18

Constants.LABELSTYLE

Kind: static constant of Constants

Constants.REGION_MARKER

Kind: static constant of Constants
Default: BLUE_MARKER

Constants.labelStyle

Kind: static constant of Constants

Constants.set_theme()

Sets the theme to default/current values

Kind: static method of Constants

Constants~pricing_constants

Kind: inner constant of Constants
Default: {"company_name":"Pricing","twitter_account":"Pricing","facebook_account":"Pricing","instagram_account":"Pricing","linkedin_account":"Pricing","email_account":"info@Pricing.com","logoFont":"Roboto","titleFont":"Roboto","themeFont":"Nunito","themeBackgroundColor":"#ccbebe","themeColor":"#181818","themeAccent":"#726b6b","themeShadows":"#d7ecfa","ThemeDarkColor":"#8a8a8a","themeBorderColor":"#cacaca","themeReverse":"#fefefe","themeReverseText":"#181818","palePrimaryColor":"#d7ecfa","secondaryColor":"#767676","paleSecondaryColor":"#eaeaea","successColor":"#3adb76","paleSuccessColor":"#e1faea","warningColor":"#ffae00","paleWarningColor":"#fff3d9","alertColor":"#cc4b37","paleAlertColor":"#f9ecea","themeBooked":"goldenrod","themeUnbooked":"blue","themeOpen":"green","themeWorking":"orange","themePledge":"green","themeTicket":"FireBrick","themeTour":"black","paymentTheme":"stripe"}

Constants~pricing_dark

Kind: inner constant of Constants
Default: {"company_name":"Pricing","twitter_account":"Pricing","facebook_account":"Pricing","instagram_account":"Pricing","linkedin_account":"Pricing","email_account":"info@Pricing.com","logoFont":"Roboto","titleFont":"Roboto","themeFont":"Nunito","themeBackgroundColor":"#181818","themeAccent":"#606060","themeColor":"#efefef","themeShadows":"#d7ecfa","ThemeDarkColor":"#8a8a8a","themeBorderColor":"#cacaca","themeReverse":"#fefefe","themeReverseText":"#181818","palePrimaryColor":"#606060","secondaryColor":"#767676","paleSecondaryColor":"#eaeaea","successColor":"#3adb76","paleSuccessColor":"#e1faea","warningColor":"#ffae00","paleWarningColor":"#fff3d9","alertColor":"#cc4b37","paleAlertColor":"#f9ecea","themeBooked":"goldenrod","themeUnbooked":"blue","themeOpen":"green","themeWorking":"orange","themePledge":"green","themeTicket":"FireBrick","themeTour":"black","paymentTheme":"night"}

Constants~themes

Kind: inner constant of Constants
Default: ["pricing_dark","pricing_constants"]

ReduxStore

Redux Store and State modules

FundamentalsRedux

ImagesRedux

PaymentRedux

PeopleRedux

StagesRedux

StagesActions

StagesActions.LOAD_STAGES

Kind: static constant of StagesActions
Default: "LOAD_STAGES"

StagesActions.loadStages(stages) ⇒ ActionItem

Returns an ActionItem

Kind: static method of StagesActions

Param Type
stages Array.Stage

StagesActions.updateStages(stages) ⇒ ActionItem

Creates and Dispathes an ActionItem

Kind: static method of StagesActions

Param Type
stages Array.Stage

StagesActions.stagesList() ⇒ Array.Stage

Kind: static method of StagesActions

StagesActions.selectSkills(state) ⇒ Array.Stage

Kind: static method of StagesActions

Param Type
state ReduxSlice

FundamentalsReducer

module.exports(state, action) ⇒ ReduxSlice

reducer

Kind: Exported function

Param Type
state ReduxSlice
action ActionItem

module.exports~InitialState

Kind: inner constant of module.exports
Default: {}

ImagesReducer

module.exports(state, action) ⇒ ReduxSlice

reducer

Kind: Exported function

Param Type
state ReduxSlice
action ActionItem

module.exports~InitialState

Kind: inner constant of module.exports
Default: {"image":null,"banner":null,"loading":null}

PaymentReducer

module.exports(state, action) ⇒ ReduxSlice

reducer

Kind: Exported function

Param Type
state ReduxSlice
action ActionItem

PeopleReducer

module.exports(state, action) ⇒ ReduxSlice

reducer

Kind: Exported function

Param Type
state ReduxSlice
action ActionItem

StagesReducer

module.exports(state, action) ⇒ ReduxSlice

reducer

Kind: Exported function

Param Type
state ReduxSlice
action ActionItem

© 2020-2024 Tracy Hall

Readme

Keywords

none

Package Sidebar

Install

npm i @leaddreamer/pricingbrowser

Weekly Downloads

1

Version

0.1.0-beta.1

License

MIT

Unpacked Size

305 kB

Total Files

68

Last publish

Collaborators

  • dreamleader