@threekit-tools/treble 0.0.14 → 0.0.18

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.
@@ -2,8 +2,10 @@
2
2
  import PropTypes from 'prop-types';
3
3
  interface FlatFormProps {
4
4
  title?: string;
5
+ hideTitle?: boolean;
5
6
  alignTitle?: string;
6
7
  description?: string;
8
+ hideDescription?: boolean;
7
9
  className?: string;
8
10
  includeReservedAttributes: boolean;
9
11
  }
@@ -27,16 +27,18 @@ var FlatForm = function (props) {
27
27
  var _a = Object.assign({
28
28
  alignTitle: 'center',
29
29
  attributes: {},
30
+ hideTitle: false,
31
+ hideDescription: false,
30
32
  includeReservedAttributes: false,
31
- }, props), title = _a.title, alignTitle = _a.alignTitle, description = _a.description, attributes = _a.attributes, customClassName = _a.className, includeReservedAttributes = _a.includeReservedAttributes;
33
+ }, props), title = _a.title, hideTitle = _a.hideTitle, alignTitle = _a.alignTitle, description = _a.description, hideDescription = _a.hideDescription, attributes = _a.attributes, customClassName = _a.className, includeReservedAttributes = _a.includeReservedAttributes;
32
34
  var attributesData = (0, useConfigurator_1.default)()[0];
33
35
  if (!attributesData)
34
36
  return null;
35
37
  var filterAttributes = (0, utils_1.filterFormAttributes)(attributesData, attributes, includeReservedAttributes);
36
38
  var cls = (0, utils_1.generateFormClassName)('flat-form', customClassName, title);
37
39
  return (react_1.default.createElement(flatForm_styles_1.Wrapper, { className: cls },
38
- react_1.default.createElement(ProductName_1.default, { align: alignTitle, title: title, className: customClassName }),
39
- react_1.default.createElement(ProductDescription_1.default, { description: description, className: customClassName }),
40
+ hideTitle ? null : (react_1.default.createElement(ProductName_1.default, { align: alignTitle, title: title, className: customClassName })),
41
+ hideDescription ? null : (react_1.default.createElement(ProductDescription_1.default, { description: description, className: customClassName })),
40
42
  filterAttributes.map(function (attr, i) {
41
43
  var _a, _b, _c, _d, _e, _f;
42
44
  var Component;
@@ -9,5 +9,5 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
9
9
  Object.defineProperty(exports, "__esModule", { value: true });
10
10
  exports.Wrapper = void 0;
11
11
  var styled_components_1 = __importDefault(require("styled-components"));
12
- exports.Wrapper = styled_components_1.default.div(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n margin-bottom: 14px;\n font-size: 16px;\n font-weight: 600;\n color: ", ";\n font-family: ", ";\n"], ["\n margin-bottom: 14px;\n font-size: 16px;\n font-weight: 600;\n color: ", ";\n font-family: ", ";\n"])), function (props) { return props.theme.headingColor; }, function (props) { return props.theme.fontFamily; });
12
+ exports.Wrapper = styled_components_1.default.div(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n margin-bottom: 14px;\n font-size: 18px;\n font-weight: 600;\n color: ", ";\n font-family: ", ";\n"], ["\n margin-bottom: 14px;\n font-size: 18px;\n font-weight: 600;\n color: ", ";\n font-family: ", ";\n"])), function (props) { return props.theme.headingColor; }, function (props) { return props.theme.fontFamily; });
13
13
  var templateObject_1;
@@ -1,6 +1,6 @@
1
1
  import React from 'react';
2
2
  interface IPortalToElementProps {
3
- elementId?: string;
3
+ to?: string;
4
4
  strict?: boolean;
5
5
  }
6
6
  export declare const PortalToElement: React.FC<IPortalToElementProps>;
@@ -8,13 +8,13 @@ var react_1 = __importDefault(require("react"));
8
8
  var react_dom_1 = require("react-dom");
9
9
  var prop_types_1 = __importDefault(require("prop-types"));
10
10
  var PortalToElement = function (props) {
11
- var _a = Object.assign({ strict: false }, props), children = _a.children, elementId = _a.elementId, strict = _a.strict;
12
- if (!elementId) {
11
+ var _a = Object.assign({ strict: false }, props), children = _a.children, to = _a.to, strict = _a.strict;
12
+ if (!to) {
13
13
  if (strict)
14
14
  return null;
15
15
  return react_1.default.createElement(react_1.default.Fragment, null, children);
16
16
  }
17
- var htmlEl = document.getElementById(elementId);
17
+ var htmlEl = document.getElementById(to);
18
18
  if (!htmlEl) {
19
19
  if (strict)
20
20
  return null;
@@ -27,7 +27,7 @@ exports.PortalToElement.propTypes = {
27
27
  /**
28
28
  * The id of the HTML element you want the content to be rendered in
29
29
  */
30
- elementId: prop_types_1.default.string,
30
+ to: prop_types_1.default.string,
31
31
  /**
32
32
  * Defines the behaviour if the HTML element is not found. If strict is
33
33
  * set to `true` the content will not render, if set to `false` the
@@ -9,5 +9,5 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
9
9
  Object.defineProperty(exports, "__esModule", { value: true });
10
10
  exports.Wrapper = void 0;
11
11
  var styled_components_1 = __importDefault(require("styled-components"));
12
- exports.Wrapper = styled_components_1.default.div(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n margin-bottom: 15px;\n color: #666;\n font-family: ", ";\n"], ["\n margin-bottom: 15px;\n color: #666;\n font-family: ", ";\n"])), function (props) { return props.theme.fontFamily; });
12
+ exports.Wrapper = styled_components_1.default.div(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n margin-bottom: 15px;\n color: #666;\n font-size: 18px;\n font-family: ", ";\n"], ["\n margin-bottom: 15px;\n color: #666;\n font-size: 18px;\n font-family: ", ";\n"])), function (props) { return props.theme.fontFamily; });
13
13
  var templateObject_1;
@@ -9,5 +9,5 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
9
9
  Object.defineProperty(exports, "__esModule", { value: true });
10
10
  exports.Wrapper = void 0;
11
11
  var styled_components_1 = __importDefault(require("styled-components"));
12
- exports.Wrapper = styled_components_1.default.div(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n font-size: 20px;\n font-weight: 600;\n margin-bottom: 8px;\n text-align: ", ";\n font-family: ", ";\n"], ["\n font-size: 20px;\n font-weight: 600;\n margin-bottom: 8px;\n text-align: ", ";\n font-family: ", ";\n"])), function (props) { return props.align || 'left'; }, function (props) { return props.theme.fontFamily; });
12
+ exports.Wrapper = styled_components_1.default.div(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n font-size: 32px;\n font-weight: 600;\n margin-bottom: 8px;\n text-align: ", ";\n font-family: ", ";\n"], ["\n font-size: 32px;\n font-weight: 600;\n margin-bottom: 8px;\n text-align: ", ";\n font-family: ", ";\n"])), function (props) { return props.align || 'left'; }, function (props) { return props.theme.fontFamily; });
13
13
  var templateObject_1;
@@ -1,3 +1,3 @@
1
- declare type UseShareHook = undefined | ((msg: string | undefined) => Promise<void>);
1
+ declare type UseShareHook = undefined | ((msg: string | undefined) => Promise<undefined | string>);
2
2
  declare const useShare: () => UseShareHook;
3
3
  export default useShare;
@@ -57,11 +57,11 @@ var useShare = function () {
57
57
  case 1:
58
58
  configuration = _a.sent();
59
59
  if (!configuration)
60
- return [2 /*return*/];
60
+ return [2 /*return*/, Promise.resolve(undefined)];
61
61
  (0, utils_1.copyToClipboard)(configuration.resumableUrl);
62
62
  if (msg === null || msg === void 0 ? void 0 : msg.length)
63
63
  message_1.default.info(msg);
64
- return [2 /*return*/];
64
+ return [2 /*return*/, Promise.resolve((configuration === null || configuration === void 0 ? void 0 : configuration.resumableUrl) || undefined)];
65
65
  }
66
66
  });
67
67
  });
@@ -1,5 +1,5 @@
1
1
  import { RootState, ThreekitDispatch } from './index';
2
- import { IConfiguration, ISetConfiguration, IThreekitDisplayAttribute, IMetadata, DISPLAY_OPTIONS } from '../threekit';
2
+ import { ISetConfiguration, IThreekitDisplayAttribute, IMetadata, ThreekitInitConfig } from '../threekit';
3
3
  import { ITranslationMap } from '../api/products';
4
4
  import { ISaveConfigurationConfig, WishlistArray } from '../Treble';
5
5
  /*****************************************************
@@ -8,30 +8,17 @@ import { ISaveConfigurationConfig, WishlistArray } from '../Treble';
8
8
  export interface IThreekitCredentials {
9
9
  publicToken: string;
10
10
  assetId: string;
11
+ configurationId?: string;
11
12
  orgId: string;
12
13
  stageId?: string;
13
14
  publishStage?: string;
14
15
  threekitDomain?: string;
15
16
  }
16
- export interface ILaunchConfig {
17
+ export interface ILaunchConfig extends Omit<ThreekitInitConfig, 'el' | 'authToken' | 'orgId' | 'assetId' | 'stageId'> {
17
18
  threekitEnv?: string;
18
19
  preview: IThreekitCredentials;
19
20
  'admin-fts': IThreekitCredentials;
20
- configurationId?: string;
21
21
  elementId?: string;
22
- public: string;
23
- cache?: string;
24
- showConfigurator?: boolean;
25
- initialConfiguration?: IConfiguration;
26
- showLoadingThumbnail?: boolean;
27
- showLoadingProgress?: boolean;
28
- onLoadingProgress?: boolean;
29
- showAR?: boolean;
30
- showShare?: boolean;
31
- locale?: string;
32
- allowMobileVerticalOrbit?: boolean;
33
- publishStage?: string;
34
- display?: DISPLAY_OPTIONS;
35
22
  language?: string | undefined;
36
23
  }
37
24
  interface IPriceConfig {
@@ -87,7 +87,7 @@ var createPlayerLoaderEl = function (elementId) {
87
87
  var initialState = {
88
88
  // Player HTML element
89
89
  playerElId: undefined,
90
- // Name of the Intialized Item
90
+ // Name of the Initialized Item
91
91
  name: undefined,
92
92
  // Initialized item's metadata
93
93
  metadata: undefined,
@@ -115,15 +115,15 @@ var _a = (0, toolkit_1.createSlice)({
115
115
  setPlayerLoading: function (state, action) {
116
116
  state.isPlayerLoading = action.payload;
117
117
  },
118
- // Intialized Item's Name
118
+ // Initialized Item's Name
119
119
  setPlayerElement: function (state, action) {
120
120
  state.playerElId = action.payload;
121
121
  },
122
- // Intialized Item's Name
122
+ // Initialized Item's Name
123
123
  setName: function (state, action) {
124
124
  state.name = action.payload;
125
125
  },
126
- // Intialized Item's Metadata
126
+ // Initialized Item's Metadata
127
127
  setMetadata: function (state, action) {
128
128
  state.metadata = action.payload;
129
129
  },
@@ -264,12 +264,10 @@ var launch = function (launchConfig) { return function (dispatch) { return __awa
264
264
  var _a,
265
265
  // Threekit Env specific credentials,
266
266
  threekitEnv,
267
- // User saved configuration
268
- configurationId,
269
267
  // Threekit Player Init
270
268
  elementId,
271
269
  // cache,
272
- showConfigurator, initialConfigurationRaw, showLoadingThumbnail, showLoadingProgress, onLoadingProgress, showAR, showShare, locale, allowMobileVerticalOrbit, publishStage, display, threekitCredentials, threekitDomainRaw, assetId, authToken, orgId, stageId, threekitDomain, initialConfiguration, updatedAssetId, params, configId, configuration, el, _b, player, translations, pricebook, _c, priceConfig, productName, wishlistData;
270
+ showConfigurator, initialConfigurationRaw, showLoadingThumbnail, showLoadingProgress, onLoadingProgress, showAR, showShare, locale, allowMobileVerticalOrbit, publishStage, display, threekitCredentials, threekitDomainRaw, assetId, authToken, orgId, stageId, configurationId, threekitDomain, initialConfiguration, updatedAssetId, params, configId, configuration, el, _b, player, translations, pricebook, _c, priceConfig, productName, wishlistData;
273
271
  var _d;
274
272
  var _e;
275
273
  return __generator(this, function (_f) {
@@ -277,10 +275,10 @@ var launch = function (launchConfig) { return function (dispatch) { return __awa
277
275
  case 0:
278
276
  if (window.threekit)
279
277
  return [2 /*return*/];
280
- _a = Object.assign(constants_1.DEFAULT_PLAYER_CONFIG, launchConfig), threekitEnv = _a.threekitEnv, configurationId = _a.configurationId, elementId = _a.elementId, showConfigurator = _a.showConfigurator, initialConfigurationRaw = _a.initialConfiguration, showLoadingThumbnail = _a.showLoadingThumbnail, showLoadingProgress = _a.showLoadingProgress, onLoadingProgress = _a.onLoadingProgress, showAR = _a.showAR, showShare = _a.showShare, locale = _a.locale, allowMobileVerticalOrbit = _a.allowMobileVerticalOrbit, publishStage = _a.publishStage, display = _a.display;
278
+ _a = Object.assign(constants_1.DEFAULT_PLAYER_CONFIG, launchConfig), threekitEnv = _a.threekitEnv, elementId = _a.elementId, showConfigurator = _a.showConfigurator, initialConfigurationRaw = _a.initialConfiguration, showLoadingThumbnail = _a.showLoadingThumbnail, showLoadingProgress = _a.showLoadingProgress, onLoadingProgress = _a.onLoadingProgress, showAR = _a.showAR, showShare = _a.showShare, locale = _a.locale, allowMobileVerticalOrbit = _a.allowMobileVerticalOrbit, publishStage = _a.publishStage, display = _a.display;
281
279
  threekitCredentials = launchConfig[threekitEnv || 'preview'];
282
280
  threekitDomainRaw = threekitCredentials.threekitDomain || "".concat(threekitEnv, ".threekit.com");
283
- assetId = threekitCredentials.assetId, authToken = threekitCredentials.publicToken, orgId = threekitCredentials.orgId, stageId = threekitCredentials.stageId;
281
+ assetId = threekitCredentials.assetId, authToken = threekitCredentials.publicToken, orgId = threekitCredentials.orgId, stageId = threekitCredentials.stageId, configurationId = threekitCredentials.configurationId;
284
282
  // Connection
285
283
  connection_1.default.connect({
286
284
  authToken: authToken,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@threekit-tools/treble",
3
- "version": "0.0.14",
3
+ "version": "0.0.18",
4
4
  "author": "Amaan Saeed",
5
5
  "license": "MIT",
6
6
  "files": [