Global

Members

(constant) client

In React components, you should use Apollo.

Source:

In React components, you should use Apollo. This client is available for Blaze components and other code, but ideally we will not need this forever.

composer

Builds productMediaById object and passes to child component

Source:

(constant) createdAt

Source:
To Do:
  • TEMP mocks this will be removed in favor of a fixture/factory solution

formatPhoneNumber

prepends country code to phone no. if required

Source:

generateSitemaps

Generates & stores sitemap documents for one or more shops, without Meteor method context

Source:

generateSitemapsJob

Initializes and processes a job that regenerates XML sitemaps

Source:

getAbsoluteUrl

Combines and returns the given root URL and path

Source:

getRootNode

Loads and returns element for #react-root

Source:

getRootUrl

Returns the root URL, returning process.env.ROOT_URL if set, otherwise using the request's protocol & hostname

Source:

getSitemapXML

Loads and returns the XML for one of a shop's sitemaps

Source:

getTagSuggestions

Returns tags matching the given term

Source:

handleSitemapRoutes

Route handler/middleware for generated sitemap XML files

Source:

highlightInput

Uses a CSS animation to briefly highlight an input

Source:

highlightVariantInput

Does the same as highlightInput, but with a lighter green color

Source:

initApollo

Initializes Apollo Client

Source:

initBrowserRouter

Renders app inside of Apollo and React Router HOCs

Source:

(constant) internalProductIds

Source:
To Do:
  • TEMP mocks these will be removed in favor of a fixture/factory solution

(constant) internalShopId

Source:
To Do:
  • TEMP Mocks these will be removed in favor of a fixture/factory solution

(constant) internalTagIds

Source:
To Do:
  • TEMP mocks these will be removed in favor of a fixture/factory solution

isShopPrimary

Whether the current shop is the Primary Shop (vs a Merchant Shop)

Source:

lazyLoadMonths

Dynamically imports MomentJS locales and returns an array of months in user's language.

Source:

loadData

Load fixture data into various collections if those collections are blank

.

Source:

Load fixture data into various collections if those collections are blank

loadMore

Load more content for a Apollo GraphQL query

.

Source:

Load more content for a Apollo GraphQL query

(constant) mockCatalogItems

mock internal catalog items

.

Source:

mock internal catalog items

(constant) mockExternalCatalogOptions

mock external catalog product variant options

.

Source:

mock external catalog product variant options

(constant) mockExternalCatalogProductNodes

Mock absolute URLs in catalog products when returned from GraphQL

.

Source:

Mock absolute URLs in catalog products when returned from GraphQL

(constant) mockExternalCatalogProducts

mock external catalog products

.

Source:

mock external catalog products

(constant) mockExternalCatalogVariants

mock external catalog product variants

.

Source:

mock external catalog product variants

(constant) mockInternalCatalogOptions

mock internal catalog product variant options

.

Source:

mock internal catalog product variant options

(constant) mockInternalCatalogProducts

mock internal catalog products

.

Source:

mock internal catalog products

(constant) mockInternalCatalogVariants

mock internal catalog product variants

.

Source:

mock internal catalog product variants

(constant) mockSortedByPriceHigh2LowCatalogItemsResponse

mock sorted by minPrice high to low catalogItems query response

.

Source:

mock sorted by minPrice high to low catalogItems query response

(constant) mockSortedByPriceLow2HighCatalogItemsResponse

mock sorted by minPrice low to high catalogItems query response

.

Source:

mock sorted by minPrice low to high catalogItems query response

(constant) mockUnsortedCatalogItemsResponse

mock unsorted catalogItems query response

.

Source:

mock unsorted catalogItems query response

sendEmailCompleted

Callback for when an email has successfully been sent. Updates email status in DB, logs a debug message, and marks job as done.

Source:

sendEmailFailed

Callback for when an email delivery attempt has failed. Updates email status in DB, logs an error message, and marks job as failed.

Source:

sendSMTPEmail

Responds to the "sendEmail" app event to send an email via SMTP

Source:

setupCdn

sets prefix for the user who wants to serve bundled js and css files from different URL

Source:

startup

Called on startup. Initializes SMTP email handler.

Source:

Methods

accountMongoSchemaToGraphQL(mongoAccount) → {Object}

Source:
Parameters:
Name Type Description
mongoAccount Object

The Account document in MongoDB schema

Returns:

The Account document in GraphQL schema

Type
Object

addCartItems(context, input, optionsopt) → {Promise.<Object>}

Add one or more items to a cart

Source:
Parameters:
Name Type Attributes Description
context Object

an object containing the per-request state

input Object

mutation input

options Object <optional>

Options

Properties
Name Type Attributes Description
skipPriceCheck Boolean <optional>

For backwards compatibility, set to true to skip checking price. Skipping this is not recommended for new code.

Returns:

An object with cart, minOrderQuantityFailures, and incorrectPriceFailures properties. cart will always be the full updated cart document, but incorrectPriceFailures and minOrderQuantityFailures may still contain other failures that the caller should optionally retry with the corrected price or quantity.

Type
Promise.<Object>

Apps(optionHash) → {Array.<Object>}

Source:
Parameters:
Name Type Description
optionHash optionHash

Option hash

Returns:

returns an array of filtered, structure reactionApps

Type
Array.<Object>

buildAccountSearch()

buildAccountSearch

Source:

buildAccountSearchRecord()

buildAccountSearchRecord

Source:

(async) buildOrderItem(inputItem, currencyCode, context) → {Promise.<Object>}

Builds an order item

Source:
Parameters:
Name Type Description
inputItem Object

Order item input. See schema.

currencyCode String

The order currency code

context Object

an object containing the per-request state

Returns:

An order item, matching the schema needed for insertion in the Orders collection

Type
Promise.<Object>

buildOrderSearch()

buildOrderSearch

Source:

buildOrderSearchRecord()

buildOrderSearchRecord

Source:

camelToSpace(str) → {String}

convert a camelcased string to spaces

Source:
Parameters:
Name Type Description
str String

camelcased string

Returns:

returns space formatted string

Type
String

cartCleanupJob() → {undefined}

A background job for removing stale carts

Source:
Returns:
Type
undefined

check() → {Boolean}

Mock Meteor.check function for the Node app

Source:
Returns:

true

Type
Boolean

checkoutLoginCompleted() → {Boolean}

Source:
Returns:

true if it's an account cart or already has an email

Type
Boolean

composer(props, onData)

composer - reactive Tracker wrapped function

Source:
Since:
  • 1.1.12
Parameters:
Name Type Description
props Object
onData function

composer(props, onData) → {undefined}

Composer

Source:
Parameters:
Name Type Description
props Object

Provided props

onData function

Call this with props

Returns:
Type
undefined

composer(props, onData) → {undefined}

Products composer

Source:
Parameters:
Name Type Description
props Object

Props from parent

onData function

Call with props changes

Returns:
Type
undefined

composer(props, onData) → {undefined}

Composer for LoginInline component

Source:
Parameters:
Name Type Description
props Object

Props from parent

onData function

Data callback

Returns:
Type
undefined

composer(props, onData) → {undefined}

StripePaymentFormContainer composer

Source:
Parameters:
Name Type Description
props Object

Passed in props

onData function

Call this with more props

Returns:
Type
undefined

composer(props, onData) → {undefined}

StripePaymentFormContainer composer

Source:
Parameters:
Name Type Description
props Object

Passed in props

onData function

Call this with more props

Returns:
Type
undefined

composer(props, onData) → {undefined}

Source:
Parameters:
Name Type Description
props Object

Props from parent

onData function

Callback

Returns:
Type
undefined

composer(props, onData) → {undefined}

Composer function

Source:
Parameters:
Name Type Description
props Object

Props from parent

onData function

Callback to pass more props

Returns:
Type
undefined

composer(props, onData) → {undefined}

Source:
Parameters:
Name Type Description
props Object

Passed props

onData function

Callback to call with data

Returns:
Type
undefined

composer(props, onData) → {undefined}

ExampleIOUPaymentForm composer

Source:
Parameters:
Name Type Description
props Object

Passed in props

onData function

Call this with more props

Returns:
Type
undefined

composeUrl(pathOrOptionsopt, optionalOptionsopt) → {String}

Generate an absolute URL pointing to the application. The server reads from the ROOT_URL environment variable to determine where it is running. This is taken care of automatically for apps deployed to Galaxy, but must be provided when using meteor build. (this code is based on Meteor.absoluteUrl)

Source:
Parameters:
Name Type Attributes Description
pathOrOptions String <optional>

A path to append to the root URL. Do not include a leading "/".

optionalOptions Object <optional>

URL composition options

Properties
Name Type Description
secure Boolean

Create an HTTPS URL.

replaceLocalhost Boolean

Replace localhost with 127.0.0.1. Useful for services that don't recognize localhost as a domain name.

options.rootUrl String

Override the default ROOT_URL from the server environment. For example: "http://foo.example.com"

Returns:

the crafted URL

Type
String

convertCart(cart) → {Object}

Source:
Parameters:
Name Type Description
cart Object

The cart document to transform

Returns:

The converted cart document

Type
Object

convertInvoice(invoice) → {Object}

Converts a single invoice object

Source:
Parameters:
Name Type Description
invoice Object

The invoice document to transform

Returns:

The converted invoice document

Type
Object

convertOrder(order, packages) → {Object}

Source:
Parameters:
Name Type Description
order Object

The order document to transform

packages Array.<Object>

Array of all Package docs from the database

Returns:

The converted order document

Type
Object

convertOrderFulfillmentGroup(group, order, packages) → {Object}

Converts a single order fulfillment group

Source:
Parameters:
Name Type Description
group Object

The order fulfillment group document to transform

order Object

The order document in which this group lives

packages Array.<Object>

Array of all Package docs from the database

Returns:

The converted order document

Type
Object

convertOrderItem(item) → {Object}

Converts a single order item

Source:
Parameters:
Name Type Description
item Object

The order item document to transform

Returns:

The converted order item document

Type
Object

createCart(context, input) → {Promise.<Object>}

Create a new cart for a shop with an initial list of items in it.

Source:
Parameters:
Name Type Description
context Object

an object containing the per-request state

input Object

mutation input

Properties
Name Type Attributes Description
items String

An array of cart items to add to the new cart. Must not be empty.

shopId String

The ID of the shop that will own this cart

shouldCreateWithoutItems Boolean <optional>

Create even if items is empty or becomes empty due to price mismatches? Default is false. This is for backwards compatibility with old Meteor code that creates the cart prior to adding items and should not be set to true in new code.

Returns:

An object with cart, minOrderQuantityFailures, and incorrectPriceFailures properties. cart will be null if all prices were incorrect. If at least one item could be added, then the cart will have been created and returned, but incorrectPriceFailures and minOrderQuantityFailures may still contain other failures that the caller should optionally retry with the correct price or quantity.

Type
Promise.<Object>

createFlatRateFulfillmentMethodMutation(context, input) → {Promise.<Object>}

Creates a flat rate fulfillment method

Source:
Parameters:
Name Type Description
context Object

an object containing the per-request state

input Object

Input (see SimpleSchema)

Returns:

An object with a method property containing the created method

Type
Promise.<Object>

createOrder(context, input) → {Promise.<Object>}

Creates an order

Source:
Parameters:
Name Type Description
context Object

an object containing the per-request state

input Object

Necessary input. See SimpleSchema

Returns:

Object with order property containing the created order

Type
Promise.<Object>

decodeCartItemsOpaqueIds(items) → {Array.<Object>}

Source:
Parameters:
Name Type Description
items Array.<Object>

Array of CartItemInput

Returns:

Same array with all IDs transformed to internal

Type
Array.<Object>

defaultAddCallMethod(context) → {undefined}

A default addCallMeteorMethod function. Adds callMeteorMethod function to the context (mutates it)

Source:
Parameters:
Name Type Description
context Object

The application context

Returns:
Type
undefined

deleteFlatRateFulfillmentMethodMutation(context, input) → {Promise.<Object>}

deletes a flat rate fulfillment method

Source:
Parameters:
Name Type Description
context Object

an object containing the per-request state

input Object

Input (see SimpleSchema)

Returns:

An object with a method property containing the deleted method

Type
Promise.<Object>

determineInitialGroupForItem(currentGroups, supportedFulfillmentTypes, shopId) → {Object|null}

Figures out which fulfillment group a cart item should initially be in

Source:
Parameters:
Name Type Description
currentGroups Array.<Object>

The current cart fulfillment groups array

supportedFulfillmentTypes Array.<String>

Array of fulfillment types supported by the item

shopId String

The ID of the shop that owns the item (product)

Returns:

The group or null if no viable group

Type
Object | null

enablePaymentMethodForShop(context, input) → {Promise.<Array.<Object>>}

Enables (or disables) payment method for a given shop

Source:
Parameters:
Name Type Description
context Object

an object containing the per-request state

input Object

EnablePaymentMethodForShopInput

Properties
Name Type Attributes Description
isEnabled String

Whether to enable or disable specified payment method

paymentMethodName String

The name of the payment method to enable or disable

shopId String

The id of the shop to enable payment method on

clientMutationId String <optional>

An optional string identifying the mutation call

Returns:

Array

Type
Promise.<Array.<Object>>

expandAuthToken(token) → {Object}

Expands an Auth token

Source:

Given an Authorization Bearer token it returns a JSON object with user properties and claims found

Parameters:
Name Type Description
token String

Auth token

Returns:

JSON object

Type
Object

flattenCatalogProductVariants(product) → {Array}

Flatten variant tree from a Catalog Item Product document

.

Source:

Flatten variant tree from a Catalog Item Product document

Parameters:
Name Type Description
product Object

A Catalog Item Product document

Returns:

Variant array

Type
Array

formatForStripe(amount) → {Number}

Stripe uses a "Decimal-less" format so 10.00 becomes 1000

Source:
Parameters:
Name Type Description
amount Number

Non-Stripe amount

Returns:

Stripe amount

Type
Number

formatMoney(price, currencyInfoopt) → {String}

A wrapper around accounting.formatMoney that handles minor differences between Reaction API and accounting.js API.

Source:

A wrapper around accounting.formatMoney that handles minor differences between Reaction API and accounting.js API.

Parameters:
Name Type Attributes Description
price Number

A price (float)

currencyInfo Object <optional>

A currency object in Reaction schema

Returns:

Formatted currency string such as "$15.99". If currencyInfo is not provided, returns accounting.toFixed(price, 2).

Type
String

getAnonymousCartsReactive() → {Array.<Object>}

Gets a reactive array of anonymous carts saved locally

Source:
Returns:

Cart objects with _id and token

Type
Array.<Object>

getCatalogProductMedia(productId, collections) → {Promise.<Array.<Object>>}

Get an array of ImageInfo objects by Product ID

Source:
Parameters:
Name Type Description
productId String

A product ID. Must be a top-level product.

collections Object

Raw mongo collections

Returns:

Array of ImageInfo objects sorted by priority

Type
Promise.<Array.<Object>>

(async) getCurrencyExchangeObject(collections, cartCurrencyCode, shopId, accountopt) → {Object}

Gets an object representing the exchange rate at the time of an order

Source:
Parameters:
Name Type Attributes Description
collections Object

Map of MongoDB collections

cartCurrencyCode String

The currency code of the cart

shopId String

The ID of the shop that owns the order

account Object <optional>

Current account for this request, if there is one

Returns:

Object with userCurrency and exchangeRate properties

Type
Object

(async) getCurrencyRates(collections, shopId, currencyCode) → {Number|null}

Gets currency rates from a shop

Source:
Parameters:
Name Type Description
collections Object

Map of MongoDB collections

shopId String

The ID of the shop to get rates from

currencyCode String

The currency code

Returns:

The rate, or null if there isn't one.

Type
Number | null

getCurrentCatalogPriceForProductConfigurations(productConfigurations, currencyCode) → {Promise.<Array.<Object>>}

"catalog/getCurrentCatalogPriceForProductConfigurations" Meteor method wrapped in Promise

Source:
Parameters:
Name Type Description
productConfigurations Array.<Object>

Array of product configurations

currencyCode String

Currency in which to get prices

Returns:

Same productConfigurations array, with price added

Type
Promise.<Array.<Object>>

getDisplayPrice(minPrice, maxPrice, currencyInfo) → {String}

Returns a price for front-end display in the given currency

Source:
Parameters:
Name Type Description
minPrice Number

Minimum price

maxPrice Number

Maximum price

currencyInfo Object

Currency object from Reaction shop schema

Returns:

Display price with currency symbol(s)

Type
String

getEditFocus()

get "edit/focus" value from current Reaction state

Source:
Since:
  • 1.1.12

getGraphQLContextInMeteorMethod(userId) → {Object}

Call this in a Meteor method that wraps a GraphQL mutation, to get a context to pass to the mutation.

Source:

Calls buildContext to build a GraphQL context object, after first looking up the user by userId in collections.users.

Usage in a Meteor method:

const context = Promise.await(getGraphQLContextInMeteorMethod(this.userId));
Parameters:
Name Type Description
userId String

The user ID for the current request

Returns:

A GraphQL context object

Type
Object

getInvoiceForFulfillmentGroup(group, discountTotal) → {Object}

Calculate final shipping, discounts, and taxes, and build an invoice object with the totals on it.

Source:
Parameters:
Name Type Description
group Object

The fulfillment group

discountTotal Number

Total discount amount

Returns:

Invoice object with totals

Type
Object

(async) getMerchantStripeId(context, shopId) → {String}

Source:
Parameters:
Name Type Description
context Object

Context

shopId String

Shop ID

Returns:

The Stripe account ID for this shop. Throws if there isn't one

Type
String

getPriceRange(prices, currencyInfoopt) → {Promise.<Object>}

Get Price object from array of Product prices

Source:
Parameters:
Name Type Attributes Description
prices Array

Array of Product price properties

currencyInfo Object <optional>

A currency object in Reaction schema

Returns:

PriceRange object

Type
Promise.<Object>

getProductPriceRange(productId, collections) → {Promise.<Object>}

Get the PriceRange object for a Product by ID

Source:
Parameters:
Name Type Description
productId String

A product ID

collections Object

Raw mongo collections

Returns:

Product PriceRange object

Type
Promise.<Object>

getSelectedProducts() → {Array.<Object>}

Get the list of selected products

Source:
Returns:

Product documents

Type
Array.<Object>

getShippingAddressWithId(addressInput, addressIdInput) → {Object}

Combines shippingAddress and shippingAddressId input

Source:
Parameters:
Name Type Description
addressInput Object

Address from the client

addressIdInput String

Address ID from the client

Returns:

shippingAddress object

Type
Object

(async) getShopPrefix(collections, shopId) → {String}

Returns the URL prefix for a shop

Source:
Parameters:
Name Type Description
collections Object

Map of MongoDB collections

shopId String

The shop ID

Returns:

Prefix that begins with "/"

Type
String

getStripeShippingObjectForFulfillmentGroup(group) → {Object|null}

Given a fulfillment group, returns a Stripe shipping object if it has a shipping address set on it. Otherwise returns null.

Source:
Parameters:
Name Type Description
group Object

A fulfillment group object matching Reaction's cart schema

Returns:

The shipping object.

Type
Object | null

getStripeShippingObjectForFulfillmentGroup(group) → {Object|null}

Given a fulfillment group, returns a Stripe shipping object if it has a shipping address set on it. Otherwise returns null.

Source:
Parameters:
Name Type Description
group Object

A fulfillment group object matching Reaction's cart schema

Returns:

The shipping object.

Type
Object | null

getSubmitHandler(billingAddress, billingAddressId, cart, cartTokenopt) → {function}

Builds a submit handler function

Source:
Parameters:
Name Type Attributes Description
billingAddress Object

Address to be sent with placeOrder mutation

billingAddressId String

Address ID to be sent with placeOrder mutation

cart Object

Cart document

cartToken String <optional>

Token for anonymous carts

Returns:

onSubmit function

Type
function

getSubmitHandler(billingAddress, billingAddressId, cart, cartTokenopt) → {function}

Builds a submit handler function

Source:
Parameters:
Name Type Attributes Description
billingAddress Object

Address to be sent with placeOrder mutation

billingAddressId String

Address ID to be sent with placeOrder mutation

cart Object

Cart document

cartToken String <optional>

Token for anonymous carts

Returns:

onSubmit function

Type
function

getSubmitHandler(billingAddress, billingAddressId, cart, cartTokenopt) → {function}

Builds a submit handler function

Source:
Parameters:
Name Type Attributes Description
billingAddress Object

Address to be sent with placeOrder mutation

billingAddressId String

Address ID to be sent with placeOrder mutation

cart Object

Cart document

cartToken String <optional>

Token for anonymous carts

Returns:

onSubmit function

Type
function

(async) getTaxRateForShop(collections, group) → {Number|null}

Gets the tax rate based on shop ID and shipping address of a fulfillment group

Source:
Parameters:
Name Type Description
collections Object

Map of MongoDB collections

group Object

The fulfillment group to get a tax rate for

Returns:

Tax rate, e.g., 0.01 means 1%

Type
Number | null

getTopLevelProduct(productOrVariantId, collections) → {Promise.<Array.<Object>>}

Get a top level product based on provided ID

Source:
Parameters:
Name Type Description
productOrVariantId String

A variant or top level Product Variant ID.

collections Object

Raw mongo collections.

Returns:

Top level product object.

Type
Promise.<Array.<Object>>

getTopLevelProduct(productOrVariantId, collections) → {Promise.<Array.<Object>>}

Get a top level product based on provided ID

Source:
Parameters:
Name Type Description
productOrVariantId String

A variant or top level Product Variant ID.

collections Object

Raw mongo collections.

Returns:

Top level product object.

Type
Promise.<Array.<Object>>

getUserId() → {String}

returns the userId of logged in user (e.g Meteor.userId())

Source:
Returns:

String

Type
String

getUserId() → {String}

returns the userId of logged in user (e.g Meteor.userId())

Source:
Returns:

String

Type
String

getVariantPriceRange(variantId, collections) → {Promise.<Object>}

Create a Product PriceRange object by taking the lowest variant price and the highest variant price to create the PriceRange. If only one variant use that variant's price to create the PriceRange

Source:
Parameters:
Name Type Description
variantId string

A product variant ID.

collections Object

Raw mongo collections

Returns:

Product PriceRange object

Type
Promise.<Object>

getVariantQuantity(variant, collection, variants) → {Promise.<number>}

Get the number of product variants still avalible to purchase. This function can take only a top level variant object and a mongo collection as params to return the product variant quantity. This method can also take a top level variant, mongo collection and an array of product variant options as params to skip the db lookup and return the variant quantity based on the provided options.

Source:
Parameters:
Name Type Description
variant Object

A top level product variant object.

collection Object

Raw mongo collections.

variants Array.<Object>

Array of product variant option objects.

Returns:

Variant quantity.

Type
Promise.<number>

getVariants(productOrVariantId, collections, topOnly) → {Promise.<Array.<Object>>}

Get all of a Product's Variants or only a Product's top level Variants.

Source:
Parameters:
Name Type Description
productOrVariantId string

A Product or top level Product Variant ID.

collections Object

Raw mongo collections.

topOnly boolean

True to return only a products top level variants.

Returns:

Array of Product Variant objects.

Type
Promise.<Array.<Object>>

groupMongoSchemaToGraphQL(mongoGroup) → {Object}

Source:
Parameters:
Name Type Description
mongoGroup Object

The Group document in MongoDB schema

Returns:

The Group document in GraphQL schema

Type
Object

groupMongoSchemaToGraphQL(mongoGroup) → {Object}

Source:
Parameters:
Name Type Description
mongoGroup Object

The Group document in MongoDB schema

Returns:

The Group document in GraphQL schema

Type
Object

hasChildVariant(productOrVariantId, collections) → {Promise.<boolean>}

Return true if a Product or Variant has at least 1 child Product that is visible and not deleted.

Source:
Parameters:
Name Type Description
productOrVariantId string

A Product or Product Variant ID.

collections Object

Raw mongo collections.

Returns:

True if Product has a child.

Type
Promise.<boolean>

(async) hashRelatedProduct(media, collections) → {Promise.<null>}

Recalculate the currentProductHash for the related product

Source:
Parameters:
Name Type Description
media Object

The media document

collections Object

Map of MongoDB collections

Returns:

Null

Type
Promise.<null>

oauthLogin(options) → {String}

Source:
Parameters:
Name Type Description
options Object

options passed from client call

Properties
Name Type Description
challenge String

Used to fetch information about the login request from Hydra.

remember Boolean

tells hydra to remember the browser and automatically authenticate the user in future requests

Returns:

redirectUrl

Type
String

onCardExpand(cardName) → {function}

set "edit/focus" in current Reaction state

Source:
Since:
  • 1.1.12
Parameters:
Name Type Description
cardName String

card name to be set

Returns:

callback

Type
function

orderCreditMethod(order) → {Object}

the first credit payment on the order

Source:
Parameters:
Name Type Description
order Object

The order doc

Returns:

The payment

Type
Object

packageData() → {Object}

get Stripe Package record

Source:
Returns:

Package data

Type
Object

packageData() → {Object}

get Stripe Package record

Source:
Returns:

Package data

Type
Object

placeMarketplaceOrderWithStripeCardPayment(context, input) → {Promise.<Object>}

Authorizes a credit card, given its Stripe-created token, and then creates an order with that payment attached.

Source:
Parameters:
Name Type Description
context Object

an object containing the per-request state

input Object

Necessary input. See SimpleSchema

Returns:

Object with order property containing the created order

Type
Promise.<Object>

placeOrderWithExampleIOUPayment(context, input) → {Promise.<Object>}

As an example and for demos, this non-production payment method creates payments without charging any credit card

Source:
Parameters:
Name Type Description
context Object

an object containing the per-request state

input Object

Necessary input. See SimpleSchema

Returns:

Object with orders property containing the created orders

Type
Promise.<Object>

placeOrderWithStripeCardPayment(context, input) → {Promise.<Object>}

Authorizes a credit card, given its Stripe-created token, and then creates an order with that payment attached.

Source:
Parameters:
Name Type Description
context Object

an object containing the per-request state

input Object

Necessary input. See SimpleSchema

Returns:

Object with order property containing the created order

Type
Promise.<Object>

publishProducts(context, productIds) → {Promise.<Array.<Object>>}

Publish an array of products to the Catalog collection by Product ID

Source:
Parameters:
Name Type Description
context Object

an object containing the per-request state

productIds Array

An array of product IDs

Returns:

Array of CatalogItemProduct objects

Type
Promise.<Array.<Object>>

publishProductsToCatalog(_, context) → {Promise.<Object>}

Publish Products to the Catalog collection by Product ID

Source:
Parameters:
Name Type Description
_ Object

unused

args.productIds Array.<String>

an array of Product IDs

context Object

an object containing the per-request state

Returns:

TODO: make sure this is the correct return type and this function needs to be async

Type
Promise.<Object>

pushCartWorkflow() → {undefined}

Push cart workflow past "checkoutLogin" and potentially past "checkoutAddressBook"

Source:
Returns:
Type
undefined

reconcileCarts(context, input) → {Promise.<Object>}

Call this with account credentials, passing in an anonymous cart, and the anonymous cart will be merged into the account cart. The "mode" argument allows you to specify whether the items should be merged, or if items should be kept from just one of the carts. If this mutation does not throw an error, the anonymous cart will be destroyed by the time this function returns.

Source:
Parameters:
Name Type Description
context Object

an object containing the per-request state

input Object

mutation input

Properties
Name Type Attributes Description
anonymousCartId String

The anonymous cart ID

anonymousCartToken String

The anonymous cart token

mode String <optional>

The reconciliation mode, "merge", "keepAccountCart", or "keepAnonymousCart". Default "merge"

Returns:

Object in which cart property is set to the updated account cart

Type
Promise.<Object>

removeCartItems(context, input) → {Promise.<Object>}

Removes one or more items from a cart

Source:
Parameters:
Name Type Description
context Object

an object containing the per-request state

input Object

Necessary input

Properties
Name Type Description
cartId String

The ID of the cart in which all of the items exist

cartItemIds Array.<String>

Array of cart item IDs to remove

token String

The token if the cart is an anonymous cart

Returns:

An object containing the updated cart in a cart property

Type
Promise.<Object>

saveDefaultSize(size) → {function}

call "shop/updateDefaultParcelSize" method

Source:
Since:
  • 1.1.12
Parameters:
Name Type Description
size Object

size object to be saved

Returns:

callback

Type
function

selectFulfillmentOptionForGroup(context, input) → {Promise.<Object>}

Selects a fulfillment option for a fulfillment group

Source:
Parameters:
Name Type Description
context Object

an object containing the per-request state

input Object

an object of all mutation arguments that were sent by the client

Properties
Name Type Attributes Description
cartId String

The ID of the cart to select a fulfillment option for

cartToken String <optional>

The token for the cart, required if it is an anonymous cart

fulfillmentGroupId String

The group to select a fulfillment option for

fulfillmentMethodId String

The fulfillment method ID from the option the shopper selected

Returns:

An object with a cart property containing the updated cart

Type
Promise.<Object>

(async) sendNotificationToAdmin(collections, adminUserId, shopId) → {undefined}

Sends a new order notification to an admin

Source:
Parameters:
Name Type Description
collections Object

Map of MongoDB collections

adminUserId String

User ID (not account ID)

shopId String

The ID of the shop this person is admin for

Returns:
Type
undefined

setAnonymousCarts(carts) → {undefined}

Sets an array of anonymous carts saved locally

Source:
Parameters:
Name Type Description
carts Array.<Object>

objects with _id and token

Returns:
Type
undefined

setBaseContext(context) → {undefined}

Sets the baseContext used by getGraphQLContextInMeteorMethod

Source:
Parameters:
Name Type Description
context Object

The context object

Returns:
Type
undefined

setEmailOnAnonymousCart(context, input) → {Promise.<Object>}

Assigns email to anonymous user's cart instance

Source:
Parameters:
Name Type Description
context Object

an object containing the per-request state

input Object

an object of all mutation arguments that were sent by the client

Properties
Name Type Description
cartId String

An anonymous cart ID

token String

The token for accessing the anonymous cart

email String

The email address to associate with this cart

Returns:

An object with cart property containing the updated cart

Type
Promise.<Object>

setShippingAddressOnCart(context, input) → {Promise.<Object>}

Sets the shippingAddress data for all fulfillment groups on a cart that have a type of "shipping"

Source:
Parameters:
Name Type Description
context Object

an object containing the per-request state

input Object

Input (see SimpleSchema)

Returns:

An object with a cart property containing the updated cart

Type
Promise.<Object>

setupStaleCartHook() → {undefined}

Adds an afterCoreInit hook for removing stale carts

Source:
Returns:
Type
undefined

shop/updateDefaultParcelSize(parcel) → {Object}

update defaultParcelSize for a shop

Source:
Since:
  • 1.1.12
Parameters:
Name Type Description
parcel Object

size to be updated

Returns:

The update call result

Type
Object

sortCartItems(cartItems, connectionArgs) → {Array.<Object>}

Sorts the provided cart items according to the connectionArgs.

Source:
Parameters:
Name Type Description
cartItems Array.<Object>

Array of cart items

connectionArgs ConnectionArgs

An object of all arguments that were sent by the client

Returns:

Sorted list of cart items

Type
Array.<Object>

sortOrderItems(orderItems, connectionArgs) → {Array.<Object>}

Sorts the provided order items according to the connectionArgs.

Source:
Parameters:
Name Type Description
orderItems Array.<Object>

Array of order items

connectionArgs ConnectionArgs

An object of all arguments that were sent by the client

Returns:

Sorted list of order items

Type
Array.<Object>

storeAnonymousCart(cart) → {undefined}

Saves a single anonymous cart locally

Source:
Parameters:
Name Type Description
cart Object

Object with _id and token

Returns:
Type
undefined

(async) synchronousPromiseLoop(funcs, args) → {undefined}

calls each function in an array with args, one at a time

Source:
Parameters:
Name Type Description
funcs Array.<function()>

List of functions to call

args Array

Arguments to pass to each function

Returns:

Promise that resolves with undefined after all functions in the list have been called

Type
undefined

transform(results) → {Array.<Object>}

filter and extract shipping methods from flat rate shipping provider

Source:
Parameters:
Name Type Description
results Array.<Object>

The find results

Returns:

The methods from the flatRates record

Type
Array.<Object>

unformatFromStripe(amount) → {Number}

Stripe uses a "Decimal-less" format so 10.00 becomes 1000

Source:
Parameters:
Name Type Description
amount Number

Stripe amount

Returns:

Non-Stripe amount

Type
Number

unstoreAnonymousCart(cartId) → {undefined}

Removes a single anonymous cart from local save list

Source:
Parameters:
Name Type Description
cartId String

The cart ID

Returns:
Type
undefined

updateCartAddresses(updatedAddress) → {Promise.<Array.<Boolean>>}

Update shipping or billing address for cart

Source:
Parameters:
Name Type Description
updatedAddress Object

Address

Returns:

Resolves with 0 or more results

Type
Promise.<Array.<Boolean>>

updateCartItemsQuantity(context, input) → {Promise.<Object>}

Sets a new quantity for one or more items in a cart

Source:
Parameters:
Name Type Description
context Object

an object containing the per-request state

input Object

Necessary input

Properties
Name Type Description
cartId String

The ID of the cart in which all of the items exist

items String

Array of items to update

Properties
Name Type Description
cartItemId Number

The cart item ID

quantity Object

The new quantity, which must be an integer of 0 or greater

token String

The token if the cart is an anonymous cart

Returns:

An object containing the updated cart in a cart property

Type
Promise.<Object>

updateCatalogProduct(userId, selector, modifier, validation) → {String}

Updates a product document.

Source:
Parameters:
Name Type Description
userId String

currently logged in user

selector Object

selector for product to update

modifier Object

Object describing what parts of the document to update.

validation Object

simple schema validation options

Returns:

_id of updated document

Type
String

updateFlatRateFulfillmentMethodMutation(context, input) → {Promise.<Object>}

updates a flat rate fulfillment method

Source:
Parameters:
Name Type Description
context Object

an object containing the per-request state

input Object

Input (see SimpleSchema)

Returns:

An object with a method property containing the updated method

Type
Promise.<Object>

updateFulfillmentOptionsForGroup(context, input) → {Promise.<Object>}

Updates the fulfillment quotes for a fulfillment group

Source:
Parameters:
Name Type Description
context Object

an object containing the per-request state

input Object

an object of all mutation arguments that were sent by the client

Properties
Name Type Attributes Description
cartId String

The ID of the cart to update fulfillment options for

cartToken String <optional>

The token for the cart, required if it is an anonymous cart

fulfillmentGroupId String

The group to update fulfillment options for

Returns:

An object with a cart property containing the updated cart

Type
Promise.<Object>

xformCartCheckout(collections, cart) → {Object}

Source:
Parameters:
Name Type Description
collections Object

Map of Mongo collections

cart Object

Cart document

Returns:

Checkout object

Type
Object

xformCartFulfillmentGroup(fulfillmentGroup, cart) → {Object}

Transform a single fulfillment group

Source:
Parameters:
Name Type Description
fulfillmentGroup Object

Fulfillment group

cart Object

Full cart document, with items already transformed

Returns:

Transformed group

Type
Object

xformCartItem(context, catalogItems, products, cartItem) → {Object}

Source:
Parameters:
Name Type Description
context Object

an object containing the per-request state

catalogItems Array.<Object>

Array of CatalogItem docs from the db

products Array.<Object>

Array of Product docs from the db

cartItem Object

CartItem

Returns:

Same object with GraphQL-only props added

Type
Object

xformCartItems(context, items) → {Array.<Object>}

Source:
Parameters:
Name Type Description
context Object

an object containing the per-request state

items Array.<Object>

Array of CartItem

Returns:

Same array with GraphQL-only props added

Type
Array.<Object>

xformOrderFulfillmentGroupPayment(payment) → {Object}

Transform a single fulfillment group payment

Source:
Parameters:
Name Type Description
payment Object

A payment object

Returns:

Transformed payment

Type
Object

xformOrderFulfillmentGroupSelectedOption(fulfillmentOption) → {Object}

Transform a single fulfillment group fulfillment option

Source:
Parameters:
Name Type Description
fulfillmentOption Object

The group.shipmentMethod

Returns:

Transformed fulfillment option

Type
Object

xformOrderItem(context, item, catalogItems, products) → {Object}

Source:
Parameters:
Name Type Description
context Object

an object containing the per-request state

item Object

The order fulfillment group item in DB format

catalogItems Array.<Object>

Array of CatalogItem docs from the db

products Array.<Object>

Array of Product docs from the db

Returns:

Same object with GraphQL-only props added

Type
Object

xformOrderItems(context, items) → {Array.<Object>}

Source:
Parameters:
Name Type Description
context Object

an object containing the per-request state

items Array.<Object>

Array of order fulfillment group items

Returns:

Same array with GraphQL-only props added

Type
Array.<Object>

xformProduct(data) → {Object}

The core function for transforming a Product to a CatalogProduct

Source:
Parameters:
Name Type Description
data Object

Data obj

Properties
Name Type Description
collections Object

Map of MongoDB collections by name

product Object

The source product

shop Object

The Shop document for the shop that owns the product

variants Array.<Object>

The Product documents for all variants of this product

Returns:

The CatalogProduct document

Type
Object

xformTotalItemQuantity(collections, items) → {Number}

Source:
Parameters:
Name Type Description
collections Object

Map of Mongo collections

items Object

Cart items

Returns:

Total quantity of all items in the cart

Type
Number

Type Definitions

MongoCollection

Meteor Mongo.Collection instance

.

Source:

Meteor Mongo.Collection instance

Type:
  • Object

optionHash

Source:
Properties:
Name Type Description
name String

name of a package.

provides String

purpose of this package as identified to the registry

container String

filter registry entries for matching container.

shopId String

filter to only display results matching shopId, not returned

template String

filter registry entries for matching template

Type:
  • Object