Skip to content

Commit

Permalink
Merge pull request reactioncommerce#16 from sportsdirect/brent-merge-…
Browse files Browse the repository at this point in the history
…latest-develop

Merge latest develop
  • Loading branch information
samkelleher committed Jan 22, 2019
2 parents 7127d72 + c24252e commit 2f1080f
Show file tree
Hide file tree
Showing 176 changed files with 3,097 additions and 3,061 deletions.
1 change: 1 addition & 0 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,4 @@ REACTION_SECURE_DEFAULT_ADMIN=false
REACTION_USER_NAME=admin
REACTION_USER=Admin
ROOT_URL=http://localhost:3000
IDENTITY_PROVIDER_MODE=all
31 changes: 28 additions & 3 deletions .snyk
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,39 @@
version: v1.11.0
# ignores vulnerabilities until expiry date; change duration by modifying expiry date
ignore:
'SNYK-JS-BOOTSTRAP-72889':
- bootstrap:
reason: We're not going to update to Bootstrap 4 and we don't use Bootstrap JS
expires: '2019-12-31T20:23:03.274Z'
'SNYK-JS-BOOTSTRAP-72890':
- bootstrap:
reason: We're not going to update to Bootstrap 4 and we don't use Bootstrap JS. Will re-evaluate once bootstrap is eliminated.
expires: '2019-12-31T20:23:03.274Z'
'npm:bootstrap:20160627':
- bootstrap:
reason: We're not going to update to Bootstrap 4 any time soon
expires: '2018-10-26T20:23:03.274Z'
reason: We're not going to update to Bootstrap 4 and we don't use Bootstrap JS
expires: '2019-12-31T20:23:03.274Z'
'npm:bootstrap:20180529':
- bootstrap:
reason: We're not going to update to Bootstrap 4 and we don't use Bootstrap JS
expires: '2019-12-31T20:23:03.274Z'
'SNYK-JS-CHOWNR-73502':
- '*':
reason: "We don't use chownr in an untrusted system where a possible attacker has access to the filesystem where the user script is running chown. chownr is a recursive fs operation and TOCTOU is fundamental to the way it works."
expires: '2019-12-31T20:23:03.274Z'
'npm:chownr:20180731':
- '*':
reason: "PR in chownr to resolve issue will require node >= 10.8 https://github.com/isaacs/chownr/pull/15"
expires: '2018-09-29T20:23:03.274Z'
expires: '2019-12-31T20:23:03.274Z'
'npm:mem:20180117':
- '*':
reason: String of dependencies that need to be updated - oslocale (PR https://github.com/sindresorhus/os-locale/pull/31) followed by yargs then transliteration
expires: '2019-01-14T00:00:00.274Z'
'npm:braces:20180219':
- '*':
reason: Low severity issue we'll address as part of our 2.0 final security work.
expires: '2019-01-14T00:00:00.274Z'
'SNYK-JS-MERGE-72553':
- '*':
reason: Low severity issue we'll address as part of our 2.0 final security work.
expires: '2019-01-14T00:00:00.274Z'
28 changes: 27 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,42 @@ This is our eighth **release candidate** for v2.0.0 of Reaction. Please check it

## New Bits
### Operator 2.0
The core experience and UI for a shop operator using Reaction Commerce has not changed much over the last couple of years. We've been hard at work on the new and improved [storefront](https://github.com/reactioncommerce/reaction-next-starterkit) but until now have not revealed any of our design or plans for improving the updated operator UI.


This release includes the first beta of the new Reaction operator UI. Our focus with this new operator UI has several goals. First, we’re transitioning from a single page storefront and admin experience to a full page admin experience that will be separate from the storefront. . We believe this change is necessary and beneficial for anyone operating a store that works with a large number of products and/or does a high-volume of order. This change also decouples the customer facing storefront from the operator UI. The existing UI had a WYSIWYG flavor to it where the product and catalog management was done in an interface that was identical to what the customer saw. There are some benefits to this - having a good perspective of what your customers see when you make a change - but for large catalogs, it's not very practical. In addition, we’ve received feedback that the experience could be confusing for admin users who wanted to concentrate on their admin tasks only. Once decoupled the operator UI can use 100% of the screen space for store management and operation. The change will be a big benefit to users managing large product catalogs and complex fulfillment patterns.

Right now this new operator UI is opt-in and the existing, drawer style operator experience will continue to function as it has. You can access the new operator UI by visiting `/operator`.

<img width="1245" alt="operator_2 0" src="https://user-images.githubusercontent.com/486340/48387165-7a44f080-e6a9-11e8-8977-75893be34ee2.png">

This UI should have all existing functionality baked in, but we anticipate that there may be some rough edges and from a user experience standpoint it is the first step on a longer path. The first step here has been to replicate existing functionality by moving existing components into the new layout and fixing bugs that we've found. Going forward, we'll be implementing improved UIs for many of the operator tools - Catalog Management, Inventory, Pricing, Order Management, etc.

Please file an issue for any bugs that you find, whether they be weird UI quirks or things that don't as expected.

### .env file
Most services that make up the Reaction platform use a .env file in the root of the service folder to define environment variables that should be set while running. They also have a pre-build script that the reaction-platform tool runs to create or update the .env file from a .env.example file, which is committed. Until now, this project did not use ` .env` file, so we've added one. See https://github.com/reactioncommerce/reaction/pull/4826 for more details.

## Improved Bits
### Support for extending GraphQL enums and unions
We've updated GraphQL and GraphQL Tools to new versions and added support for `extend enum` and `extend union`. This permits extending the core schema in this way from a plugin. See https://github.com/reactioncommerce/reaction/pull/4798 for more details

### Developer performance
Added two environment variables to the example .env file `.env.example` (https://github.com/reactioncommerce/reaction/pull/4826)
When we introduced `reaction-platform` and begun developing in Docker environments, we began to notice high CPU utilization that for those of us developing on OSX.

<img width="1143" alt="image" src="https://user-images.githubusercontent.com/1203639/51052875-dc787f80-158c-11e9-9f16-60f81e43b4ec.png">

Long story short, this is an [issue with filesystem operations in Docker for Mac](https://github.com/docker/for-mac/issues/1759#issue-237416539) and there's not much we can do to resolve the core issue. In development mode, we leverage Meteor to watch for file changes. By adjusting the polling interval for the Meteor file watcher, we can greatly reduce the issues introduced by Docker for Mac. We've set two environment variables in the example .env file `.env.example` (https://github.com/reactioncommerce/reaction/pull/4826) as follows, but if these don't work for you, I'd start by adjusting the polling interval to something higher - 20000 (20s) or 30000 (30s). If you're working directly on the core `reaction` project, this may impact how long it takes before a change you've made is recognized and rebuilt, but that may be a small price to pay to reduce CPU burn by hyperkit. There shouldn't be any other consequences to increasing this number.

```
METEOR_DISABLE_OPTIMISTIC_CACHING=1
METEOR_WATCH_POLLING_INTERVAL_MS=10000
```


## Breaking changes
This release contains a number of breaking changes that we've been working to get into Reaction before we cut the final 2.0.0 release. If you're planning to update an existing shop, please read through this list

### Catalog
- Added a new, final param to xformVariant with the processed inventory flags (https://github.com/reactioncommerce/reaction/pull/4742)

Expand Down
1 change: 1 addition & 0 deletions client/modules/i18n/currency.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ export function findCurrency(defaultCurrency, useDefaultShopCurrency) {

/**
* @name formatPriceString
* @deprecated Slowly migrating everything to use `formatMoney` from "/imports/utils/formatMoney" instead
* @summary Return shop/locale specific formatted price. Also accepts a range formatted with " - ".
* @memberof i18n
* @method
Expand Down
15 changes: 14 additions & 1 deletion imports/collections/schemas/orders.js
Original file line number Diff line number Diff line change
Expand Up @@ -342,7 +342,6 @@ export const OrderFulfillmentGroup = new SimpleSchema({
},
"items.$": OrderItem,
"itemIds": [String],
"payment": Payment,
"shipmentMethod": SelectedFulfillmentOption,
"shippingLabelUrl": {
type: String,
Expand Down Expand Up @@ -372,6 +371,7 @@ export const OrderFulfillmentGroup = new SimpleSchema({
* @property {String} _id required
* @property {String} accountId Account ID for account orders, or null for anonymous
* @property {String} anonymousAccessToken Token for accessing anonymous carts, null for account carts
* @property {Address} [billingAddress] Optional billing address
* @property {String} cartId optional For tracking which cart created this order
* @property {Date} createdAt required
* @property {String} currencyCode required
Expand All @@ -380,6 +380,7 @@ export const OrderFulfillmentGroup = new SimpleSchema({
* @property {Object[]} exportHistory optional
* @property {History[]} history optional
* @property {Notes[]} notes optional
* @property {Payment[]} payments Array of payments
* @property {Shipment[]} shipping Array of fulfillment groups
* @property {String} shopId required The owner shop
* @property {OrderTransaction[]} transactions optional
Expand All @@ -401,6 +402,13 @@ export const Order = new SimpleSchema({
index: 1,
optional: true
},
// Although billing address is typically needed only by the payment plugin,
// some tax services require it to calculate taxes for digital items. Thus
// it should be provided here in order to be added to the CommonOrder if possible.
"billingAddress": {
type: Address,
optional: true
},
"cartId": {
type: String,
optional: true
Expand Down Expand Up @@ -438,6 +446,11 @@ export const Order = new SimpleSchema({
optional: true
},
"notes.$": Notes,
"payments": {
type: Array,
optional: true
},
"payments.$": Payment,
"referenceId": String,
"shipping": [OrderFulfillmentGroup],
"shopId": {
Expand Down
11 changes: 10 additions & 1 deletion imports/collections/schemas/payments.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import { Address } from "./address";
* @property {Number} total Grand total
*/
export const Invoice = new SimpleSchema({
currencyCode: String,
discounts: {
type: Number,
min: 0
Expand Down Expand Up @@ -79,6 +80,7 @@ registerSchema("CurrencyExchangeRate", CurrencyExchangeRate);
* @property {String} [cardBrand] The brand of card, if the payment method was a credit card
* @property {CurrencyExchangeRate} [currency] The exchange rate, if the user's currency is different from shop's
* @property {Object} [data] Arbitrary data that the payment method needs
* @property {String} mode "authorize" if still needs to be captured, or "capture" if captured. "cancel" if auth was canceled.
* @property {Invoice} invoice A summary of the totals that make up the full charge amount. Created when the payment is added to an order.
* @property {String} shopId The ID of the shop that is being paid. This might be a merchant shop in a marketplace setup.
*/
Expand All @@ -92,6 +94,14 @@ export const Payment = new SimpleSchema({
optional: true
},
"amount": Number,
"captureErrorCode": {
type: String,
optional: true
},
"captureErrorMessage": {
type: String,
optional: true
},
"cardBrand": {
type: String,
optional: true
Expand All @@ -108,7 +118,6 @@ export const Payment = new SimpleSchema({
blackbox: true
},
"displayName": String,
"invoice": Invoice,
"method": String,
"mode": String,
"name": String,
Expand Down
5 changes: 5 additions & 0 deletions imports/collections/schemas/registry.js
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,11 @@ export const PackageConfig = new SimpleSchema({
type: Boolean,
defaultValue: true
},
"version": {
type: String,
label: "Package Version",
optional: true
},
"icon": {
type: String,
optional: true
Expand Down
19 changes: 15 additions & 4 deletions imports/node-app/core/util/appEvents.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import Logger from "@reactioncommerce/logger";

/**
* This is a temporary events solution on our path to
* event streams and services. For now, some code relies
Expand All @@ -7,16 +9,25 @@

/**
* @summary calls each function in an array with args, one at a time
* @param {String} name Event name
* @param {Function[]} funcs List of functions to call
* @param {Array} args Arguments to pass to each function
* @returns {undefined} Promise that resolves with undefined after all
* functions in the list have been called
*/
async function synchronousPromiseLoop(funcs, args) {
async function synchronousPromiseLoop(name, funcs, args) {
const func = funcs.shift();
await func(...args);

// One function failing should not prevent others from running,
// so catch and log
try {
await func(...args);
} catch (error) {
Logger.error(`Error in "${name}" consumer`, error);
}

if (funcs.length) {
await synchronousPromiseLoop(funcs, args);
await synchronousPromiseLoop(name, funcs, args);
}
}

Expand All @@ -28,7 +39,7 @@ class AppEvents {

// Can't use forEach or map because we want each func to wait
// until the previous func promise resolves
await synchronousPromiseLoop(this.handlers[name].slice(0), args);
await synchronousPromiseLoop(name, this.handlers[name].slice(0), args);
}

on(name, func) {
Expand Down
19 changes: 18 additions & 1 deletion imports/node-app/devserver/mutations.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,25 @@
import { merge } from "lodash";
// CORE
import accounts from "/imports/plugins/core/accounts/server/no-meteor/mutations";
import cart from "/imports/plugins/core/cart/server/no-meteor/mutations";
import catalog from "/imports/plugins/core/catalog/server/no-meteor/mutations";
import navigation from "/imports/plugins/core/navigation/server/no-meteor/mutations";
import orders from "/imports/plugins/core/orders/server/no-meteor/mutations";
import payments from "/imports/plugins/core/payments/server/no-meteor/mutations";
import shipping from "/imports/plugins/core/shipping/server/no-meteor/mutations";
import taxes from "/imports/plugins/core/taxes/server/no-meteor/mutations";
// INCLUDED
import shippingRates from "/imports/plugins/included/shipping-rates/server/no-meteor/mutations";

export default merge({}, accounts, cart, catalog, orders, taxes);
export default merge(
{},
accounts,
cart,
catalog,
navigation,
orders,
payments,
shipping,
taxes,
shippingRates
);
17 changes: 16 additions & 1 deletion imports/node-app/devserver/queries.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,25 @@
import { merge } from "lodash";
// CORE
import accounts from "/imports/plugins/core/accounts/server/no-meteor/queries";
import address from "/imports/plugins/core/address/server/no-meteor/queries";
import cart from "/imports/plugins/core/cart/server/no-meteor/queries";
import catalog from "/imports/plugins/core/catalog/server/no-meteor/queries";
import core from "/imports/plugins/core/core/server/no-meteor/queries";
import navigation from "/imports/plugins/core/navigation/server/no-meteor/queries";
import orders from "/imports/plugins/core/orders/server/no-meteor/queries";
import taxes from "/imports/plugins/core/taxes/server/no-meteor/queries";
// INCLUDED
import shippingRates from "/imports/plugins/included/shipping-rates/server/no-meteor/queries";

export default merge({}, accounts, address, cart, catalog, core, orders, taxes);
export default merge(
{},
accounts,
address,
cart,
catalog,
core,
navigation,
orders,
taxes,
shippingRates
);
10 changes: 4 additions & 6 deletions imports/node-app/devserver/resolvers.js
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
// CORE
import { merge } from "lodash";
import accounts from "/imports/plugins/core/accounts/server/no-meteor/resolvers";
import address from "/imports/plugins/core/address/server/no-meteor/resolvers";
import cart from "/imports/plugins/core/cart/server/no-meteor/resolvers";
import catalog from "/imports/plugins/core/catalog/server/no-meteor/resolvers";
import core from "/imports/plugins/core/core/server/no-meteor/resolvers";
import navigation from "/imports/plugins/core/navigation/server/no-meteor/resolvers";
import orders from "/imports/plugins/core/orders/server/no-meteor/resolvers";
import payments from "/imports/plugins/core/payments/server/no-meteor/resolvers";
import product from "/imports/plugins/core/product/server/no-meteor/resolvers";
import shipping from "/imports/plugins/core/shipping/server/no-meteor/resolvers";
import taxes from "/imports/plugins/core/taxes/server/no-meteor/resolvers";
import marketplace from "/imports/plugins/included/marketplace/server/no-meteor/resolvers";
import paymentsExample from "/imports/plugins/included/payments-example/server/no-meteor/resolvers";
import paymentsStripe from "/imports/plugins/included/payments-stripe/server/no-meteor/resolvers";
// INCLUDED
import shippingRates from "/imports/plugins/included/shipping-rates/server/no-meteor/resolvers";

export default merge(
Expand All @@ -21,13 +21,11 @@ export default merge(
cart,
catalog,
core,
navigation,
orders,
payments,
product,
shipping,
taxes,
marketplace,
paymentsExample,
paymentsStripe,
shippingRates
);
2 changes: 1 addition & 1 deletion imports/plugins/core/accounts/register.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ Reaction.registerPackage({
template: "loginFormUpdatePassword",
workflow: "none",
meta: { noAdminControls: true },
name: "Reset Password",
name: "reset-password",
label: "reset-password"
}],
layout: [{
Expand Down
2 changes: 1 addition & 1 deletion imports/plugins/core/accounts/server/init.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,6 @@ Hooks.Events.add("afterCoreInit", () => {
Reaction.addRolesToGroups({
allShops: true,
groups: ["guest", "customer"],
roles: ["account/verify"]
roles: ["account/verify", "reset-password"]
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,11 @@ input AddressInput {
"Optional second line"
address2: String

"""
Optionally, a name for this address (e.g. "Home") to easily identify it in the future
"""
addressName: String

"City"
city: String!

Expand Down Expand Up @@ -74,9 +79,9 @@ input AddressInput {
}

"Represents a physical or mailing address somewhere on Earth"
type Address implements Node {
type Address {
"The address ID"
_id: ID!
_id: ID

"The street address / first line"
address1: String!
Expand Down Expand Up @@ -119,15 +124,15 @@ type Address implements Node {
}

"Wraps a list of `Addresses`, providing pagination cursors and information."
type AddressConnection implements NodeConnection {
type AddressConnection {
edges: [AddressEdge]
nodes: [Address]
pageInfo: PageInfo!
totalCount: Int!
}

"A connection edge in which each node is an `Address` object"
type AddressEdge implements NodeEdge {
type AddressEdge {
cursor: ConnectionCursor!
node: Address
}
Expand Down

0 comments on commit 2f1080f

Please sign in to comment.