These are chat archives for reactioncommerce/reaction

17th
Feb 2016
Khalid Almuraee
@Kalmuraee
Feb 17 2016 13:10
Does reaction have plugins to extend its functionality ?
rkhunter
@rkhunter
Feb 17 2016 13:12
@Kalmuraee check out reaction packages at atmosphere
Anyway, I have pulled features-v0.12 and tried running it in windows. It returns theme not found around 6 times, then app crashes. Is it what happens currently or it's my setup issue?
Brent Hoover
@zenweasel
Feb 17 2016 13:19
Those are just the official packages
rkhunter
@rkhunter
Feb 17 2016 13:19
@Kalmuraee yes, and there are other 3rd-party packages like reaction-cod
Just search for reaction at atmospherejs.com
Brent Hoover
@zenweasel
Feb 17 2016 13:20
Try searching just reaction to find third-party packages
rkhunter
@rkhunter
Feb 17 2016 13:20
@zenweasel do you know anything about feautures-v0.12 status or about my error?
Brent Hoover
@zenweasel
Feb 17 2016 13:21
Aaron is going to put in PR's in the morning
I don't know anything about that particular error
rkhunter
@rkhunter
Feb 17 2016 13:22
@zenweasel do you run features-v0,
successfully?
Brent Hoover
@zenweasel
Feb 17 2016 13:22
I have not been running it as I am working on other things
But I will be tomorrow
rkhunter
@rkhunter
Feb 17 2016 13:23
@zenweasel alright, thanks anyway :smile:
Brent Hoover
@zenweasel
Feb 17 2016 13:24
Aaron was still working on it up until a couple of hours ago
Lukas Sägesser
@ScyDev
Feb 17 2016 14:45
Is it somehow possible to run RC without variants on the products? So no variants need to be entered and the buyer doesn't need to choose a variant?
newsiberian
@newsiberian
Feb 17 2016 15:31
@ScyDev, nope, product itself is just a cover. Variants are real products
Aaron Judd
@aaronjudd
Feb 17 2016 15:32
@ScyDev but a product with one variant automatically could default to that first variant/option… it’s more of a presentation issue than a functional one..
Lukas Sägesser
@ScyDev
Feb 17 2016 15:33
Thanks. Ok then, I'll do it by auto-selecting variants and hiding them where not needed.
Spencer Norman
@spencern
Feb 17 2016 17:30
In v0.12 if I want to render a layout via an action in routes.js from a package (e.g. not via register.js) how should I go about that? Can I do something like this? Is there a ‘reaction version’ of BlazeLayout that I need to call?
rentalProductRoutes.route('/settings', {
  name: 'rentalProducts.settings',
  action: function () {
    BlazeLayout.render('structure', {
      template: 'rentalShopSettings',
      layoutHeader: 'layoutHeader',
      layoutFooter: '',
      notFound: 'notFound',
      dashboardHeader: 'dashboardHeader',
      dashboardControls: 'accountsDashboardControls',
      dashboardHeaderControls: '',
      adminControlsFooter: 'adminControlsFooter'
    });
  }
});
Spencer Norman
@spencern
Feb 17 2016 20:49

It appears that this works, curious if this is what you guys would suggest or if there’s a different way we should think about rendering admin/dashboard views.

    BlazeLayout.render('coreAdminLayout', {
      layoutHeader: 'layoutHeader',
      dashboardHeader: 'accountsDashboard',
      template: 'accountsDashboard',
      layoutFooter: 'layoutFooter',
      dashboardControls: 'dashboardControls'
    });

Should we be thinking creating our own layout per package or leveraging the ‘coreAdminLayout’ as a standard?

Aaron Judd
@aaronjudd
Feb 17 2016 21:39
@spencern sorry, was heads down on v0.12 -> now merged into development.
Spencer Norman
@spencern
Feb 17 2016 21:39
Just saw that. :clap:
About to pull it down
Aaron Judd
@aaronjudd
Feb 17 2016 21:41
while you can define the routes layouts that way, that was the “advanced” approach. this should work fine:
    route: "/cart/completed/:_id?",
    name: "cart/completed",
    template: "cartCompleted",
    workflow: "coreCartWorkflow"
  }
Spencer Norman
@spencern
Feb 17 2016 21:41
and use BlazeLayout to render it?
Aaron Judd
@aaronjudd
Feb 17 2016 21:41
the deal with layout definitions (you can see them as the first layout object
no- it’ will auto render.. we have default methods hooked up to that
Spencer Norman
@spencern
Feb 17 2016 21:42
that’s if I put the route in the registry?
Aaron Judd
@aaronjudd
Feb 17 2016 21:42
yes, the block above is all you need -> except for one thing.. that layout object on the registry is not auto inserted into the “Shops” collection yet
(on my short list)

so if you create a new layout in server/register.js

  layout: [{
    layout: "coreLayout",
    workflow: "coreCartWorkflow",
    collection: "Cart",
    theme: "default",
    enabled: true,
    structure: {
      template: "cartCheckout",
      layoutHeader: "checkoutHeader",
      layoutFooter: "",
      notFound: "notFound",
      dashboardHeader: "",
      dashboardControls: "dashboardControls",
      dashboardHeaderControls: "",
      adminControlsFooter: "adminControlsFooter"
    }
  },

you’ll need to manually add that to the Shops.layout for new (will do on package load soon)

the reason for all this… we’ll be building a layout manager to allow you adjust workflow/layout combos..
it’s also important to note that the relationship between registry and layout items is mostly around the workflow, not necessarily the layout.
Spencer Norman
@spencern
Feb 17 2016 21:47
Yeah, I’ve had my head in that file for a bit
Aaron Judd
@aaronjudd
Feb 17 2016 21:47
this why you don’t need to do “ BlazeLayout"
Spencer Norman
@spencern
Feb 17 2016 21:48
how do I call ‘renderLayout’ from a route?
or is it an exported global?
Aaron Judd
@aaronjudd
Feb 17 2016 21:49
you don’t need to, the default action will render using layout.js
Spencer Norman
@spencern
Feb 17 2016 21:49
ah
Aaron Judd
@aaronjudd
Feb 17 2016 21:50
it’s auto-magic.. you shouldn’t to do anything more than those 4 lines I gave
Spencer Norman
@spencern
Feb 17 2016 21:50
do I need to refresh the Packages collection anytime I add routes to a package?
Aaron Judd
@aaronjudd
Feb 17 2016 21:50
yes
Spencer Norman
@spencern
Feb 17 2016 21:50
That’s kindof a deal breaker
how should I do that on production?
Aaron Judd
@aaronjudd
Feb 17 2016 21:51
sorry.. you have to refresh/reset if you are changing the register.js files, not the collection
Spencer Norman
@spencern
Feb 17 2016 21:51
yeah
but it seems like I have to change the register.js file to add or change routes
Aaron Judd
@aaronjudd
Feb 17 2016 21:52
only because no UI exists -> that’s on the list -> a router editor (dashboard card already there)
Spencer Norman
@spencern
Feb 17 2016 21:53

Ah, ok.

We’ve found that the registry works really well for setting up simple packages, but (and maybe we’re abusing the intention of packages) for some of our more complex packages we have 20+ routes that each take a variety of params and setup subscriptions and data context based on the route.

That’s far easier for us to do using BlazeLayout.render() than it is using the registry
Aaron Judd
@aaronjudd
Feb 17 2016 21:54
that’s fine the whole blaze layout configuration is passed in the registry.. you’d be doing the same thing...
but I made the same choice in the paypal package… just simple to define a complex route that way
it’s ok to mix, but the idea here is that you do not need to hard define routes for packages. or be dependent on a specific router if you use the registry..
Spencer Norman
@spencern
Feb 17 2016 21:55
ah, that makes a ton of sense
Aaron Judd
@aaronjudd
Feb 17 2016 21:56
also.. console.table(ReactionRouter._routes); to keep an eye on the routes..
you’ll see that you DO need to reload the page for permissions related changes to take place ->
Spencer Norman
@spencern
Feb 17 2016 21:56
woah, fancy
Aaron Judd
@aaronjudd
Feb 17 2016 21:56
that’s because I’m rebuilding the routing table on load or on login…
Spencer Norman
@spencern
Feb 17 2016 21:57
That’s actually super helpful
Aaron Judd
@aaronjudd
Feb 17 2016 21:57
and when you call routes in the app now -> you should always use “name” not “path”(aka route)
also see: console.table(ReactionRouter._routesMap);
so you’ll note that a guest, has a different routing table than an admin
for non authenticated/non admin the dashboard routes,etc just simply don’t exist
Spencer Norman
@spencern
Feb 17 2016 21:59
Quick question on the routing topic. I’ve noticed that there is a ‘shop prefix’ on most routes now (e.g. /reaction/dashboard rather than just /dashboard)
Aaron Judd
@aaronjudd
Feb 17 2016 21:59
the shop prefix is using the shop name - change your name, change your prefix
Spencer Norman
@spencern
Feb 17 2016 22:00
Where does the prefix come from and is there a good way to inject that via a group route?
Aaron Judd
@aaronjudd
Feb 17 2016 22:00
and that will be editable customizable..
Spencer Norman
@spencern
Feb 17 2016 22:01
e.g. if I have
let rentalProductRoutes = ReactionRouter.group({
  prefix: '/dashboard/rentalProducts',
  name: 'rentalProducts'
});
Aaron Judd
@aaronjudd
Feb 17 2016 22:01
this leads to multi-shop admin
shop1/dashboard shop2/dashboard
Spencer Norman
@spencern
Feb 17 2016 22:02
is there a ReactionCore.getShopHandle() type of function I can throw in there?
Aaron Judd
@aaronjudd
Feb 17 2016 22:02
with that definition you just added you’d end up with something like shop1/dashboard/rentalProducts/dashboard/rentalProducts
I’ve not tested or added any tools for prefix, so now the perfect time to discuss / maybe create an issue for the kinds of routing mgmt would be nice.
but to keep your packages organized in the dashboard,etc you do not need to define prefix, so help to see what you’d like to see the result be..
Spencer Norman
@spencern
Feb 17 2016 22:06
maybe it’s because I’m using the flowRouter and a routes.js file vs setting up routes in the register.js, but I’ve got that group setup and am using it to define all of my package routes currently and it’s working.
Aaron Judd
@aaronjudd
Feb 17 2016 22:07
localhost_3000_dashboard_and_Edit_Document.png
This message was deleted
this little skitch should be helpful as well
Spencer Norman
@spencern
Feb 17 2016 22:08
yeah, super helpful
Aaron Judd
@aaronjudd
Feb 17 2016 22:09
are you getting a /reaction prefix in that route you are defining?
Spencer Norman
@spencern
Feb 17 2016 22:10
I’m not, was trying to figure out how to insert it
E.g. this works localhost:3000/dashboard/rentalProducts
but haven’t got the shop name in the route yet
Aaron Judd
@aaronjudd
Feb 17 2016 22:11
the thing is, you will want that prefix to look at multiple stores (there is now two stores in the default data)
Spencer Norman
@spencern
Feb 17 2016 22:11
exactly
ah, wait
Aaron Judd
@aaronjudd
Feb 17 2016 22:11
I think maybe you should try not defining a prefix at all
Spencer Norman
@spencern
Feb 17 2016 22:11
ok, so don’t include the /dashboard in the prefix either?
Aaron Judd
@aaronjudd
Feb 17 2016 22:14
right
well, that’s part of the route, so it’s ok
but it’s not the prefix
Spencer Norman
@spencern
Feb 17 2016 22:15
My understanding is that prefixes essentially concatenate with Flow Router
Aaron Judd
@aaronjudd
Feb 17 2016 22:15
I’m not defining “dashboard” or anything else as “sub” prefix...
yes.. it’s a hierarchy..
so we’re only prefix the shop, and whatever you call your route will get used after that...
(again, name is important, we’re not using a “route” based, but a “name” based approach)
Spencer Norman
@spencern
Feb 17 2016 22:16
so if I use a prefix of /dashboard/rentalProducts and then have a route defined as / then it should turn into /shopName/dashboard/rentalProducts
Aaron Judd
@aaronjudd
Feb 17 2016 22:17
a route defined as /dashboard/rentalProducts with no prefix (/) will render as /shopName/dashboard/rentalProducts
Spencer Norman
@spencern
Feb 17 2016 22:18

If you don’t mind walking me through an actual example - we’ve got a route that looks like this

rentalProductRoutes.route('/availability/:_id', {
  name: 'rentalProducts.availabilityById',
  action: function () {
    BlazeLayout.render('coreAdminLayout', {
      layoutHeader: 'layoutHeader',
      dashboardHeader: 'dashboardHeader',
      template: 'dashboardRentalProductAvailability',
      layoutFooter: 'layoutFooter',
      dashboardControls: 'dashboardControls'
    });
  }
});

Where the assumed prefix (b/c of the rentalProductRoutes group) is /dashboard/rentalProducts

Aaron Judd
@aaronjudd
Feb 17 2016 22:18
the define name: as rentalProducts, and you’d use ReactionRouter.go(‘rentalProducts), to go toshopName/dashboard/rentalProducts`
Spencer Norman
@spencern
Feb 17 2016 22:18
ahh
I think I see where I was mistaken
If I’m using ReactionRouter
does that also prefix all routes?
Aaron Judd
@aaronjudd
Feb 17 2016 22:19
    route: "/availability/:_id",
    name: "rentalProducts.availabilityById",
    template: "dashboardRentalProductAvailability",
    workflow: "coreWorkflow"
does what you want
Spencer Norman
@spencern
Feb 17 2016 22:20
yeah, but is there a way to do it without using the register?
Aaron Judd
@aaronjudd
Feb 17 2016 22:23
I don’t see any problems with yours.. other than I don’t think you need a prefix, so rentalProductRoutes.route should just be ReactionRoute.route..
Spencer Norman
@spencern
Feb 17 2016 22:24
ok
Aaron Judd
@aaronjudd
Feb 17 2016 22:27
if you want to add the shop prefix, just useconst prefix = ReactionCore.getShopName().toLowerCase();
see: ReactionRouter.initPackageRoutes
Spencer Norman
@spencern
Feb 17 2016 22:27
:+1:
Thanks a ton for the help, I think this should put me on the right track
Aaron Judd
@aaronjudd
Feb 17 2016 22:31
keep the questions coming, and issues…
I’ve tried to make this as stable a “development” merge as possible, but this one’s a whopper
doc updates coming...
Spencer Norman
@spencern
Feb 17 2016 22:39
Want issues in the main repo as they come up? Or ask here first?
Aaron Judd
@aaronjudd
Feb 17 2016 22:40
up to you, I know of some issues, that I’m going to add issues for, so ask the first few time.. we’ll figure out the unknown
Spencer Norman
@spencern
Feb 17 2016 22:40
:shipit:
Brent Hoover
@zenweasel
Feb 17 2016 23:18
@rkhunter Hey, so I think your issue was/is updating all your other packages to the current version (Stripe/Paypal/LaunchDock). I had the same issue and that cleared it up