@plasmicapp/loader-react 1.0.169 → 1.0.172

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.
@@ -6,6 +6,7 @@ interface PlasmicRootContextValue {
6
6
  loader: InternalPlasmicComponentLoader;
7
7
  variation?: Record<string, string>;
8
8
  translator?: PlasmicTranslator;
9
+ Head?: React.ComponentType<any>;
9
10
  }
10
11
  export interface GlobalVariantSpec {
11
12
  name: string;
@@ -70,6 +71,11 @@ export declare function PlasmicRootProvider(props: {
70
71
  * Translator function to be used for text blocks
71
72
  */
72
73
  translator?: PlasmicTranslator;
74
+ /**
75
+ * Head component to use in PlasmicHead component (e.g. Head from next/head
76
+ * or Helmet from react-helmet).
77
+ */
78
+ Head?: React.ComponentType<any>;
73
79
  /**
74
80
  * Page path parameters (e.g. {slug: "foo"} if page path is
75
81
  * /products/[slug] and URI is /products/foo).
@@ -1168,6 +1168,9 @@ function matchesPagePath(pagePath, lookup) {
1168
1168
  params: params
1169
1169
  };
1170
1170
  }
1171
+ function isDynamicPagePath(path) {
1172
+ return !!path.match(/\[[^/]*\]/);
1173
+ }
1171
1174
 
1172
1175
  function matchesCompMeta(lookup, meta) {
1173
1176
  if (lookup.projectId && meta.projectId !== lookup.projectId) {
@@ -1400,6 +1403,7 @@ function PlasmicRootProvider(props) {
1400
1403
  globalContextsProps = props.globalContextsProps,
1401
1404
  variation = props.variation,
1402
1405
  translator = props.translator,
1406
+ Head = props.Head,
1403
1407
  pageParams = props.pageParams,
1404
1408
  pageQuery = props.pageQuery;
1405
1409
  var loader = props.loader.__internal;
@@ -1445,9 +1449,10 @@ function PlasmicRootProvider(props) {
1445
1449
  globalContextsProps: globalContextsProps,
1446
1450
  loader: loader,
1447
1451
  variation: variation,
1448
- translator: translator
1452
+ translator: translator,
1453
+ Head: Head
1449
1454
  };
1450
- }, [globalVariants, variation, globalContextsProps, loader, splits, translator]);
1455
+ }, [globalVariants, variation, globalContextsProps, loader, splits, translator, Head]);
1451
1456
  return React.createElement(PlasmicQuery.PlasmicQueryDataProvider, {
1452
1457
  prefetchedCache: prefetchedQueryData,
1453
1458
  suspense: suspenseForQueryData
@@ -1871,7 +1876,7 @@ var InternalPlasmicComponentLoader = /*#__PURE__*/function () {
1871
1876
  }();
1872
1877
 
1873
1878
  _proto.fetchPages = /*#__PURE__*/function () {
1874
- var _fetchPages = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee4() {
1879
+ var _fetchPages = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee4(opts) {
1875
1880
  var data;
1876
1881
  return runtime_1.wrap(function _callee4$(_context4) {
1877
1882
  while (1) {
@@ -1886,7 +1891,7 @@ var InternalPlasmicComponentLoader = /*#__PURE__*/function () {
1886
1891
  case 3:
1887
1892
  data = _context4.sent;
1888
1893
  return _context4.abrupt("return", data.components.filter(function (comp) {
1889
- return comp.isPage && comp.path;
1894
+ return comp.isPage && comp.path && ((opts == null ? void 0 : opts.includeDynamicPages) || !isDynamicPagePath(comp.path));
1890
1895
  }));
1891
1896
 
1892
1897
  case 5:
@@ -1897,7 +1902,7 @@ var InternalPlasmicComponentLoader = /*#__PURE__*/function () {
1897
1902
  }, _callee4, this);
1898
1903
  }));
1899
1904
 
1900
- function fetchPages() {
1905
+ function fetchPages(_x2) {
1901
1906
  return _fetchPages.apply(this, arguments);
1902
1907
  }
1903
1908
 
@@ -1977,7 +1982,7 @@ var InternalPlasmicComponentLoader = /*#__PURE__*/function () {
1977
1982
  }, _callee6, this);
1978
1983
  }));
1979
1984
 
1980
- function fetchMissingData(_x2) {
1985
+ function fetchMissingData(_x3) {
1981
1986
  return _fetchMissingData.apply(this, arguments);
1982
1987
  }
1983
1988
 
@@ -2018,7 +2023,7 @@ var InternalPlasmicComponentLoader = /*#__PURE__*/function () {
2018
2023
  }, _callee7, this);
2019
2024
  }));
2020
2025
 
2021
- function getActiveVariation(_x3) {
2026
+ function getActiveVariation(_x4) {
2022
2027
  return _getActiveVariation2.apply(this, arguments);
2023
2028
  }
2024
2029
 
@@ -2300,12 +2305,12 @@ var PlasmicComponentLoader = /*#__PURE__*/function () {
2300
2305
  _proto2.fetchPages =
2301
2306
  /*#__PURE__*/
2302
2307
  function () {
2303
- var _fetchPages2 = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee11() {
2308
+ var _fetchPages2 = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee11(opts) {
2304
2309
  return runtime_1.wrap(function _callee11$(_context11) {
2305
2310
  while (1) {
2306
2311
  switch (_context11.prev = _context11.next) {
2307
2312
  case 0:
2308
- return _context11.abrupt("return", this.__internal.fetchPages());
2313
+ return _context11.abrupt("return", this.__internal.fetchPages(opts));
2309
2314
 
2310
2315
  case 1:
2311
2316
  case "end":
@@ -2315,7 +2320,7 @@ var PlasmicComponentLoader = /*#__PURE__*/function () {
2315
2320
  }, _callee11, this);
2316
2321
  }));
2317
2322
 
2318
- function fetchPages() {
2323
+ function fetchPages(_x5) {
2319
2324
  return _fetchPages2.apply(this, arguments);
2320
2325
  }
2321
2326
 
@@ -2367,7 +2372,7 @@ var PlasmicComponentLoader = /*#__PURE__*/function () {
2367
2372
  }, _callee13, this);
2368
2373
  }));
2369
2374
 
2370
- function _getActiveVariation(_x4) {
2375
+ function _getActiveVariation(_x6) {
2371
2376
  return _getActiveVariation3.apply(this, arguments);
2372
2377
  }
2373
2378
 
@@ -2405,7 +2410,7 @@ var PlasmicComponentLoader = /*#__PURE__*/function () {
2405
2410
  }, _callee14, this);
2406
2411
  }));
2407
2412
 
2408
- function getActiveVariation(_x5) {
2413
+ function getActiveVariation(_x7) {
2409
2414
  return _getActiveVariation4.apply(this, arguments);
2410
2415
  }
2411
2416
 
@@ -2507,7 +2512,8 @@ function PlasmicComponent(props) {
2507
2512
  var loader = rootContext.loader,
2508
2513
  globalContextsProps = rootContext.globalContextsProps,
2509
2514
  variation = rootContext.variation,
2510
- translator = rootContext.translator;
2515
+ translator = rootContext.translator,
2516
+ Head = rootContext.Head;
2511
2517
  var Component = usePlasmicComponent({
2512
2518
  name: component,
2513
2519
  projectId: projectId,
@@ -2559,7 +2565,8 @@ function PlasmicComponent(props) {
2559
2565
  projectId: projectId
2560
2566
  });
2561
2567
  element = React.createElement(ReactWebRootProvider, {
2562
- translator: translator
2568
+ translator: translator,
2569
+ Head: Head
2563
2570
  }, React.createElement(MaybeWrap, {
2564
2571
  cond: !!GlobalContextsProvider,
2565
2572
  wrapper: function wrapper(children) {