saasufy-components 3.35.0 → 3.36.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -85,6 +85,7 @@ The following utility functions can be used anywhere inside template `{{expressi
85
85
  - Remove leading and trailing spaces from text: `{{trim(' test ')}}`
86
86
  - Specify one or more fallback values in case values are null or undefined: `{{fallback(Product.imageSrc, 'path/to/default-image.png')}}`
87
87
  - Format UNIX timestamp as a human-readable date: `{{date(Product.updatedAt)}}`
88
+ - Make a string safe by escaping HTML characters: `{{safeString(Product.name)}}`
88
89
  - Given an array of objects, extract the values from the specified field and join them together into a single comma-separated string: `{{joinFields(Product, 'name')}}`
89
90
 
90
91
  ### Special fields
package/app-router.js CHANGED
@@ -186,24 +186,24 @@ export class AppRouter extends SocketConsumer {
186
186
  let hardRedirect = pageTemplate.hasAttribute('hard-redirect');
187
187
 
188
188
  if (authRedirect != null) {
189
+ routeArgs = this.computeRouteArgs(pagePath, regExp, params);
190
+ pagePath = this.substituteRouteAgs(authRedirect, routeArgs);
189
191
  if (hardRedirect) {
190
- location.hash = authRedirect;
192
+ location.hash = pagePath;
191
193
  return;
192
194
  }
193
- routeArgs = this.computeRouteArgs(pagePath, regExp, params);
194
- pagePath = this.substituteRouteAgs(authRedirect, routeArgs);
195
195
  let result = this.getMatchingPage(pagePath, 'auth-redirect');
196
196
  pageTemplate = result.pageTemplate;
197
197
  route = result.route;
198
198
  regExp = result.regExp;
199
199
  params = result.params;
200
200
  } else if (noAuthRedirect != null) {
201
+ routeArgs = this.computeRouteArgs(pagePath, regExp, params);
202
+ pagePath = this.substituteRouteAgs(noAuthRedirect, routeArgs);
201
203
  if (hardRedirect) {
202
- location.hash = noAuthRedirect;
204
+ location.hash = pagePath;
203
205
  return;
204
206
  }
205
- routeArgs = this.computeRouteArgs(pagePath, regExp, params);
206
- pagePath = this.substituteRouteAgs(noAuthRedirect, routeArgs);
207
207
  let result = this.getMatchingPage(pagePath, 'no-auth-redirect');
208
208
  pageTemplate = result.pageTemplate;
209
209
  route = result.route;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "saasufy-components",
3
- "version": "3.35.0",
3
+ "version": "3.36.0",
4
4
  "description": "Components for Saasufy.",
5
5
  "main": "index.js",
6
6
  "scripts": {
package/utils.js CHANGED
@@ -232,7 +232,8 @@ let templateFormatters = {
232
232
  combineFilters: (filterMap, useOr) => {
233
233
  return Object.values(filterMap || {}).join(useOr ? ' %OR% ' : ' %AND% ');
234
234
  },
235
- computeId
235
+ computeId,
236
+ safeString: toSafeHTML
236
237
  };
237
238
 
238
239
  let templateTripleTagsRegExp = /{{{.*?}}}/gs;