@plasmicapp/loader-react 1.0.157 → 1.0.160

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.
@@ -85,6 +85,36 @@ function _setPrototypeOf(o, p) {
85
85
  return _setPrototypeOf(o, p);
86
86
  }
87
87
 
88
+ function _isNativeReflectConstruct() {
89
+ if (typeof Reflect === "undefined" || !Reflect.construct) return false;
90
+ if (Reflect.construct.sham) return false;
91
+ if (typeof Proxy === "function") return true;
92
+
93
+ try {
94
+ Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {}));
95
+ return true;
96
+ } catch (e) {
97
+ return false;
98
+ }
99
+ }
100
+
101
+ function _construct(Parent, args, Class) {
102
+ if (_isNativeReflectConstruct()) {
103
+ _construct = Reflect.construct;
104
+ } else {
105
+ _construct = function _construct(Parent, args, Class) {
106
+ var a = [null];
107
+ a.push.apply(a, args);
108
+ var Constructor = Function.bind.apply(Parent, a);
109
+ var instance = new Constructor();
110
+ if (Class) _setPrototypeOf(instance, Class.prototype);
111
+ return instance;
112
+ };
113
+ }
114
+
115
+ return _construct.apply(null, arguments);
116
+ }
117
+
88
118
  function _unsupportedIterableToArray(o, minLen) {
89
119
  if (!o) return;
90
120
  if (typeof o === "string") return _arrayLikeToArray(o, minLen);
@@ -176,6 +206,10 @@ function prepComponentData(bundle) {
176
206
  return x.globalContextsProviderFileName;
177
207
  }).filter(function (x) {
178
208
  return !!x;
209
+ }), bundle.components.filter(function (c) {
210
+ return c.isGlobalContextProvider;
211
+ }).map(function (c) {
212
+ return c.entry;
179
213
  }), bundle.globalGroups.map(function (g) {
180
214
  return g.contextFile;
181
215
  })));
@@ -1146,6 +1180,9 @@ function getLookupSpecName(lookup) {
1146
1180
  return lookup.name;
1147
1181
  }
1148
1182
  }
1183
+ function uniq(elements) {
1184
+ return _construct(Array, new Set(elements));
1185
+ }
1149
1186
 
1150
1187
  function getFirstCompMeta(metas, lookup) {
1151
1188
  var filtered = getCompMetas(metas, lookup);
@@ -1368,7 +1405,8 @@ function PlasmicRootProvider(props) {
1368
1405
  renderCtx: {
1369
1406
  // We track the provider as a single entity
1370
1407
  rootComponentId: 'provider',
1371
- teamIds: loader.getTeamIds()
1408
+ teamIds: loader.getTeamIds(),
1409
+ projectIds: loader.getProjectIds()
1372
1410
  },
1373
1411
  variation: variation
1374
1412
  });
@@ -1957,11 +1995,17 @@ var InternalPlasmicComponentLoader = /*#__PURE__*/function () {
1957
1995
  }();
1958
1996
 
1959
1997
  _proto.getTeamIds = function getTeamIds() {
1960
- return this.bundle.projects.map(function (p) {
1961
- return p.teamId;
1998
+ return uniq(this.bundle.projects.map(function (p) {
1999
+ return p.teamId ? "" + p.teamId + (p.indirect ? '@indirect' : '') : null;
1962
2000
  }).filter(function (x) {
1963
2001
  return !!x;
1964
- });
2002
+ }));
2003
+ };
2004
+
2005
+ _proto.getProjectIds = function getProjectIds() {
2006
+ return uniq(this.bundle.projects.map(function (p) {
2007
+ return "" + p.id + (p.indirect ? '@indirect' : '');
2008
+ }));
1965
2009
  };
1966
2010
 
1967
2011
  _proto.trackRender = function trackRender(opts) {
@@ -2453,7 +2497,8 @@ function PlasmicComponent(props) {
2453
2497
  rootProjectId: meta.projectId,
2454
2498
  rootComponentId: meta.id,
2455
2499
  rootComponentName: component,
2456
- teamIds: loader.getTeamIds()
2500
+ teamIds: loader.getTeamIds(),
2501
+ projectIds: loader.getProjectIds()
2457
2502
  },
2458
2503
  variation: variation
2459
2504
  });