Core/Client

Core/Client

Source:

Reaction core namespace for client code

Members

(static) primaryShopId

primaryShopId is the first created shop.

Source:

primaryShopId is the first created shop. In a marketplace setting it's the shop that controls the marketplace and can see all other shops.

(static) shopId

shopId refers to the active shop.

Source:

shopId refers to the active shop. For most shoppers this will be the same as the primary shop, but for administrators this will usually be the shop they administer.

(static) shopId

shopId refers to the active shop.

Source:

shopId refers to the active shop. For most shoppers this will be the same as the primary shop, but for administrators this will usually be the shop they administer.

(static) state

Return global "reactionState" Reactive Dict

Source:

Methods

(static) allowGuestCheckout() → {Boolean}

Source:
Returns:

is guest checkout allowed

Type
Boolean

(static) canInviteToGroup(options) → {Boolean}

checks if the user making the request is allowed to make invitation to that group

Source:

(similar to server/api canInviteToGroup)

Parameters:
Name Type Description
options Object
Properties
Name Type Description
group Object

group to invite to

user Object

user object making the invite (Meteor.user())

Returns:
Type
Boolean

(static) clearActionView() → {undefined}

Source:
Returns:
Type
undefined

(static) clearActionViewDetail() → {undefined}

Source:
Returns:
Type
undefined

(static) getActionView() → {Object}

Source:
Returns:

current action view data

Type
Object

(static) getActionViewDetail() → {Object}

Source:
Returns:

current action view detail data

Type
Object

(static) getCurrentShop() → {Object|null}

Get the proper current shop based on various checks. This mirrors the logic in Reaction.getShopId on the server

Source:
Returns:

The shop document

Type
Object | null

(static) getCurrentTag() → {String}

Source:
Returns:

current tag

Type
String

(static) getMarketplaceSettings() → {Object}

finds the enabled reaction-marketplace package for the primary shop and returns the settings

Source:
Returns:

The marketplace settings from the primary shop or undefined

Type
Object

(static) getPackageSettings(name) → {Object}

Source:
Parameters:
Name Type Description
name String

package name

Returns:

package settings

Type
Object

(static) getPackageSettingsWithOptions(options) → {Object}

Source:
Parameters:
Name Type Description
options Object

options to pass to query

Returns:

package settings with options

Type
Object

(static) getPrimaryShopId() → {String}

Source:
Returns:

primary shop ID

Type
String

(static) getPrimaryShopName() → {String}

Source:
Returns:

shop name

Type
String

(static) getPrimaryShopSettings() → {Object}

Source:
Returns:

shop settings of the primary shop

Type
Object

(static) getRegistryForCurrentRoute(provides) → {Object}

Source:
Parameters:
Name Type Description
provides String

type of template from registry

Returns:

settings data from this package

Type
Object

(static) getSellerShopId(userId, noFallback) → {Boolean|String}

Source:
Parameters:
Name Type Description
userId String

user id of user to check seller shop ID for

noFallback Boolean

should we allow function to continue if there is no userID

Returns:

the shop ID of a seller

Type
Boolean | String

(static) getShopId() → {String}

shopId refers to the active shop.

Source:

shopId refers to the active shop. For most shoppers this will be the same as the primary shop, but for administrators this will usually be the shop they administer.

Returns:

shopId

Type
String

(static) getShopName(providedShopId) → {String}

gets name of shop by provided shopId, or current active shop if shopId is not provided

Source:
Parameters:
Name Type Description
providedShopId String

shopId of shop to return name of

Returns:
  • shop name
Type
String

(static) getShopSettings() → {Object}

Source:
Returns:

shop settings

Type
Object

(static) getUserShopId() → {String}

Get current user's shop ID, as stored in preferences

Source:
Returns:

active shop ID

Type
String

(static) hasAdminAccess(shopIdopt) → {Boolean}

Checks to see if the user has admin permissions.

Source:

Checks to see if the user has admin permissions. If a shopId is optionally passed in, we check for that shopId, otherwise we check against the default

Parameters:
Name Type Attributes Description
shopId string <optional>

Optional shopId to check access against

Returns:

true if the user has admin or owner permission, otherwise false

Type
Boolean

(static) hasDashboardAccess() → {Boolean}

Source:
Returns:

true if user has access to dashboard access

Type
Boolean

(static) hasDashboardAccessForAnyShop(options) → {Boolean}

client permission check for any "owner", "admin", or "dashboard" permissions for any shop.

Source:
To Do:
  • This could be faster with a dedicated hasAdminDashboard boolean on the user object
Parameters:
Name Type Description
options Object

options object that can be passed a user and/or a set of permissions

Returns:

Boolean - true if has dashboard access for any shop

Type
Boolean

(static) hasDashboardAccessForMultipleShops() → {Boolean}

  • client permission check for any "owner", "admin", or "dashboard" permissions for more than one shop.

Source:
Returns:

Boolean - true if has dashboard access for more than one shop

Type
Boolean

(static) hasOwnerAccess() → {Boolean}

Source:
Returns:

Boolean - true if user has owner permissions

Type
Boolean

(static) hasPermission(checkPermissions, checkUserId, checkGroup) → {Boolean}

client permissions checks. hasPermission exists on both the server and the client.

Source:
Parameters:
Name Type Description
checkPermissions String | Array

String or Array of permissions if empty, defaults to "admin, owner"

checkUserId String

userId, defaults to logged in user ID

checkGroup String

group - default to shopId

Returns:

Boolean - true if has permission

Type
Boolean

(static) hasShopSwitcherAccess() → {Boolean}

Source:
Returns:

true if user has access to dashboard for multiple shops

Type
Boolean

(static) hideActionView() → {undefined}

Source:
Returns:
Type
undefined

(static) hideActionViewDetail() → {undefined}

Source:
Returns:
Type
undefined

(static) init() → {Tracker}

Initialization code

Source:
Returns:

tracker

Type
Tracker

(static) isActionViewAtRootView() → {Boolean}

Source:
Returns:

is actionView at root view

Type
Boolean

(static) isActionViewDetailAtRootView() → {Boolean}

Source:
Returns:

is action view detail at root view

Type
Boolean

(static) isActionViewDetailOpen() → {Boolean}

Source:
Returns:

is action view detail open

Type
Boolean

(static) isActionViewOpen() → {Boolean}

Source:
Returns:

is action view open

Type
Boolean

(static) popActionView() → {undefined}

Source:
Returns:
Type
undefined

(static) popActionViewDetail() → {undefined}

Source:
Returns:
Type
undefined

(static) pushActionView(viewData) → {undefined}

Source:
Parameters:
Name Type Description
viewData Array | Object

data from open view

Returns:
Type
undefined

(static) pushActionViewDetail(viewData) → {undefined}

Source:
Parameters:
Name Type Description
viewData Array | Object

viewData to push

Returns:
Type
undefined

(static) setActionView(viewData) → {undefined}

Source:
Parameters:
Name Type Description
viewData Array | Object

data from open view

Returns:
Type
undefined

(static) setActionViewDetail(viewData, options) → {undefined}

Source:
Parameters:
Name Type Description
viewData Array | Object

viewData to push

options Object

to check if view is open

Returns:
Type
undefined

(static) setShopId(id) → {undefined}

shopId refers to the active shop.

Source:

shopId refers to the active shop. For most shoppers this will be the same as the primary shop, but for administrators this will usually be the shop they administer.

Parameters:
Name Type Description
id String

ID to set as shop ID

Returns:

undefined

Type
undefined

(static) showActionView(viewData) → {String}

Source:
Parameters:
Name Type Description
viewData String

{label, template, data}

Returns:

Session "admin/showActionView"

Type
String