@plasmicpkgs/plasmic-intercom 0.0.1
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/LICENSE +21 -0
- package/README.md +1 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.js +8 -0
- package/dist/intercom.d.ts +15 -0
- package/dist/plasmic-intercom.cjs.development.js +84 -0
- package/dist/plasmic-intercom.cjs.development.js.map +1 -0
- package/dist/plasmic-intercom.cjs.production.min.js +2 -0
- package/dist/plasmic-intercom.cjs.production.min.js.map +1 -0
- package/dist/plasmic-intercom.esm.js +75 -0
- package/dist/plasmic-intercom.esm.js.map +1 -0
- package/package.json +52 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2022 Latipov Abdukhamid
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
Plasmic components and registration calls for Intercom
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import registerComponent from "@plasmicapp/host/registerComponent";
|
|
2
|
+
import registerGlobalContext from "@plasmicapp/host/registerGlobalContext";
|
|
3
|
+
export declare function registerAll(loader?: {
|
|
4
|
+
registerComponent: typeof registerComponent;
|
|
5
|
+
registerGlobalContext: typeof registerGlobalContext;
|
|
6
|
+
}): void;
|
|
7
|
+
export * from "./intercom";
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { ComponentMeta } from "@plasmicapp/host";
|
|
2
|
+
import React from "react";
|
|
3
|
+
export declare function ensure<T>(x: T | null | undefined): T;
|
|
4
|
+
interface IntercomProviderProps {
|
|
5
|
+
workSpaceId?: string;
|
|
6
|
+
autoBoot?: boolean;
|
|
7
|
+
buttonText?: string;
|
|
8
|
+
shouldInitialize?: boolean;
|
|
9
|
+
apiBase?: string;
|
|
10
|
+
initializeDelay?: number;
|
|
11
|
+
className?: string;
|
|
12
|
+
}
|
|
13
|
+
export declare const IntercomProviderMeta: ComponentMeta<IntercomProviderProps>;
|
|
14
|
+
export declare function IntercomProvider({ apiBase, shouldInitialize, initializeDelay, workSpaceId }: IntercomProviderProps): React.JSX.Element;
|
|
15
|
+
export {};
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; }
|
|
6
|
+
|
|
7
|
+
var registerComponent = _interopDefault(require('@plasmicapp/host/registerComponent'));
|
|
8
|
+
var reactUseIntercom = require('react-use-intercom');
|
|
9
|
+
var React = _interopDefault(require('react'));
|
|
10
|
+
|
|
11
|
+
function ensure(x) {
|
|
12
|
+
if (x === null || x === undefined) {
|
|
13
|
+
debugger;
|
|
14
|
+
throw new Error("Value must not be undefined or null");
|
|
15
|
+
} else {
|
|
16
|
+
return x;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
var modulePath = "@plasmicpkgs/plasmic-intercom";
|
|
20
|
+
var IntercomProviderMeta = {
|
|
21
|
+
name: "IntercomProvider",
|
|
22
|
+
displayName: "Intercom Provider",
|
|
23
|
+
importName: "IntercomProvider",
|
|
24
|
+
importPath: modulePath,
|
|
25
|
+
providesData: true,
|
|
26
|
+
props: {
|
|
27
|
+
workSpaceId: {
|
|
28
|
+
type: "string",
|
|
29
|
+
displayName: "Workspace ID",
|
|
30
|
+
description: "ID of your workspace",
|
|
31
|
+
helpText: "The easiest way to find your workspace ID is to check the URL of any page you have open in Intercom. It's the code that comes after apps/ in the URL."
|
|
32
|
+
},
|
|
33
|
+
shouldInitialize: {
|
|
34
|
+
type: "boolean",
|
|
35
|
+
displayName: "Intercom Initialize",
|
|
36
|
+
description: "indicates if the Intercom should be initialized. Can be used in multistaged environment"
|
|
37
|
+
},
|
|
38
|
+
initializeDelay: {
|
|
39
|
+
type: "number",
|
|
40
|
+
displayName: "Delay",
|
|
41
|
+
description: "Indicates if the intercom initialization should be delayed, delay is in ms, defaults to 0"
|
|
42
|
+
},
|
|
43
|
+
apiBase: {
|
|
44
|
+
type: "string",
|
|
45
|
+
displayName: "Api Base",
|
|
46
|
+
description: "If you need to route your Messenger requests through a different endpoint than the default. Generally speaking, this is not need"
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
};
|
|
50
|
+
function IntercomProvider(_ref) {
|
|
51
|
+
var apiBase = _ref.apiBase,
|
|
52
|
+
shouldInitialize = _ref.shouldInitialize,
|
|
53
|
+
initializeDelay = _ref.initializeDelay,
|
|
54
|
+
workSpaceId = _ref.workSpaceId;
|
|
55
|
+
if (!workSpaceId) {
|
|
56
|
+
return React.createElement("div", null, "Please enter your Workspace ID");
|
|
57
|
+
}
|
|
58
|
+
return React.createElement(reactUseIntercom.IntercomProvider, {
|
|
59
|
+
appId: workSpaceId,
|
|
60
|
+
autoBoot: true,
|
|
61
|
+
apiBase: apiBase,
|
|
62
|
+
shouldInitialize: shouldInitialize,
|
|
63
|
+
initializeDelay: initializeDelay
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
function registerAll(loader) {
|
|
68
|
+
var _registerComponent = function _registerComponent(Component, defaultMeta) {
|
|
69
|
+
if (loader) {
|
|
70
|
+
loader.registerComponent(Component, defaultMeta);
|
|
71
|
+
} else {
|
|
72
|
+
registerComponent(Component, defaultMeta);
|
|
73
|
+
}
|
|
74
|
+
};
|
|
75
|
+
if (loader) {
|
|
76
|
+
_registerComponent(IntercomProvider, IntercomProviderMeta);
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
exports.IntercomProvider = IntercomProvider;
|
|
81
|
+
exports.IntercomProviderMeta = IntercomProviderMeta;
|
|
82
|
+
exports.ensure = ensure;
|
|
83
|
+
exports.registerAll = registerAll;
|
|
84
|
+
//# sourceMappingURL=plasmic-intercom.cjs.development.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plasmic-intercom.cjs.development.js","sources":["../src/intercom.tsx","../src/index.tsx"],"sourcesContent":["import {\n ComponentMeta,\n} from \"@plasmicapp/host\";\n\nimport { IntercomProvider as Provider } from 'react-use-intercom'\nimport React from \"react\";\n\nexport function ensure<T>(x: T | null | undefined): T {\n if (x === null || x === undefined) {\n debugger;\n throw new Error(`Value must not be undefined or null`);\n } else {\n return x;\n }\n}\n\nconst modulePath = \"@plasmicpkgs/plasmic-intercom\";\n\ninterface IntercomProviderProps {\n workSpaceId?: string\n autoBoot?: boolean,\n buttonText?: string,\n shouldInitialize?: boolean,\n apiBase?: string,\n initializeDelay?: number\n className?: string;\n}\nexport const IntercomProviderMeta: ComponentMeta<IntercomProviderProps> = {\n name: \"IntercomProvider\",\n displayName: \"Intercom Provider\",\n importName: \"IntercomProvider\",\n importPath: modulePath,\n providesData: true,\n props: {\n workSpaceId: {\n type: \"string\",\n displayName: \"Workspace ID\",\n description: \"ID of your workspace\",\n helpText:\"The easiest way to find your workspace ID is to check the URL of any page you have open in Intercom. It's the code that comes after apps/ in the URL.\"\n },\n shouldInitialize: {\n type: \"boolean\",\n displayName: \"Intercom Initialize\",\n description: \"indicates if the Intercom should be initialized. Can be used in multistaged environment\"\n },\n initializeDelay: {\n type: \"number\",\n displayName: \"Delay\",\n description: \"Indicates if the intercom initialization should be delayed, delay is in ms, defaults to 0\"\n\n },\n apiBase: {\n type: \"string\",\n displayName: \"Api Base\",\n description: \"If you need to route your Messenger requests through a different endpoint than the default. Generally speaking, this is not need\"\n }\n },\n};\n\nexport function IntercomProvider({\n apiBase,\n shouldInitialize,\n initializeDelay,\n workSpaceId\n}: IntercomProviderProps) {\n \n if (!workSpaceId) {\n return <div>Please enter your Workspace ID</div>\n }\n\n return (\n <Provider appId={workSpaceId} autoBoot apiBase={apiBase} shouldInitialize={shouldInitialize} initializeDelay={initializeDelay}>\n </Provider>\n )\n}\n\n","import registerComponent, {\n ComponentMeta,\n} from \"@plasmicapp/host/registerComponent\";\nimport registerGlobalContext from \"@plasmicapp/host/registerGlobalContext\";\nimport {\n IntercomProvider,\n IntercomProviderMeta,\n\n} from \"./intercom\";\n\nexport function registerAll(loader?: {\n registerComponent: typeof registerComponent;\n registerGlobalContext: typeof registerGlobalContext;\n}) {\n const _registerComponent = <T extends React.ComponentType<any>>(\n Component: T,\n defaultMeta: ComponentMeta<React.ComponentProps<T>>\n ) => {\n if (loader) {\n loader.registerComponent(Component, defaultMeta);\n } else {\n registerComponent(Component, defaultMeta);\n }\n };\n\n if (loader) {\n _registerComponent(IntercomProvider, IntercomProviderMeta);\n }\n}\n\nexport * from \"./intercom\";\n"],"names":["ensure","x","undefined","Error","modulePath","IntercomProviderMeta","name","displayName","importName","importPath","providesData","props","workSpaceId","type","description","helpText","shouldInitialize","initializeDelay","apiBase","IntercomProvider","React","Provider","appId","autoBoot","registerAll","loader","_registerComponent","Component","defaultMeta","registerComponent"],"mappings":";;;;;;;;;;SAOgBA,MAAM,CAAIC,CAAuB;EAC/C,IAAIA,CAAC,KAAK,IAAI,IAAIA,CAAC,KAAKC,SAAS,EAAE;IACjC;IACA,MAAM,IAAIC,KAAK,uCAAuC;GACvD,MAAM;IACL,OAAOF,CAAC;;AAEZ;AAEA,IAAMG,UAAU,GAAG,+BAA+B;IAWrCC,oBAAoB,GAAyC;EACxEC,IAAI,EAAE,kBAAkB;EACxBC,WAAW,EAAE,mBAAmB;EAChCC,UAAU,EAAE,kBAAkB;EAC9BC,UAAU,EAAEL,UAAU;EACtBM,YAAY,EAAE,IAAI;EAClBC,KAAK,EAAE;IACLC,WAAW,EAAE;MACXC,IAAI,EAAE,QAAQ;MACdN,WAAW,EAAE,cAAc;MAC3BO,WAAW,EAAE,sBAAsB;MACnCC,QAAQ,EAAC;KACV;IACDC,gBAAgB,EAAE;MAChBH,IAAI,EAAE,SAAS;MACfN,WAAW,EAAE,qBAAqB;MAClCO,WAAW,EAAE;KACd;IACDG,eAAe,EAAE;MACfJ,IAAI,EAAE,QAAQ;MACdN,WAAW,EAAE,OAAO;MACpBO,WAAW,EAAE;KAEd;IACDI,OAAO,EAAE;MACPL,IAAI,EAAE,QAAQ;MACdN,WAAW,EAAE,UAAU;MACvBO,WAAW,EAAE;;;;SAKHK,gBAAgB;MAC9BD,OAAO,QAAPA,OAAO;IACPF,gBAAgB,QAAhBA,gBAAgB;IAChBC,eAAe,QAAfA,eAAe;IACfL,WAAW,QAAXA,WAAW;EAGX,IAAI,CAACA,WAAW,EAAE;IAChB,OAAOQ,kEAAyC;;EAGlD,OACEA,oBAACC,iCAAQ;IAACC,KAAK,EAAEV,WAAW;IAAEW,QAAQ;IAACL,OAAO,EAAEA,OAAO;IAAEF,gBAAgB,EAAEA,gBAAgB;IAAEC,eAAe,EAAEA;IACnG;AAEf;;SChEgBO,WAAW,CAACC,MAG3B;EACC,IAAMC,kBAAkB,GAAG,SAArBA,kBAAkB,CACtBC,SAAY,EACZC,WAAmD;IAEnD,IAAIH,MAAM,EAAE;MACVA,MAAM,CAACI,iBAAiB,CAACF,SAAS,EAAEC,WAAW,CAAC;KACjD,MAAM;MACLC,iBAAiB,CAACF,SAAS,EAAEC,WAAW,CAAC;;GAE5C;EAED,IAAIH,MAAM,EAAE;IACVC,kBAAkB,CAACP,gBAAgB,EAAEd,oBAAoB,CAAC;;AAE9D;;;;;;;"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";function e(e){return e&&"object"==typeof e&&"default"in e?e.default:e}Object.defineProperty(exports,"__esModule",{value:!0});var t=e(require("@plasmicapp/host/registerComponent")),i=require("react-use-intercom"),r=e(require("react")),o={name:"IntercomProvider",displayName:"Intercom Provider",importName:"IntercomProvider",importPath:"@plasmicpkgs/plasmic-intercom",providesData:!0,props:{workSpaceId:{type:"string",displayName:"Workspace ID",description:"ID of your workspace",helpText:"The easiest way to find your workspace ID is to check the URL of any page you have open in Intercom. It's the code that comes after apps/ in the URL."},shouldInitialize:{type:"boolean",displayName:"Intercom Initialize",description:"indicates if the Intercom should be initialized. Can be used in multistaged environment"},initializeDelay:{type:"number",displayName:"Delay",description:"Indicates if the intercom initialization should be delayed, delay is in ms, defaults to 0"},apiBase:{type:"string",displayName:"Api Base",description:"If you need to route your Messenger requests through a different endpoint than the default. Generally speaking, this is not need"}}};function a(e){var t=e.workSpaceId;return t?r.createElement(i.IntercomProvider,{appId:t,autoBoot:!0,apiBase:e.apiBase,shouldInitialize:e.shouldInitialize,initializeDelay:e.initializeDelay}):r.createElement("div",null,"Please enter your Workspace ID")}exports.IntercomProvider=a,exports.IntercomProviderMeta=o,exports.ensure=function(e){if(null==e)throw new Error("Value must not be undefined or null");return e},exports.registerAll=function(e){var i,r;e&&(i=a,r=o,e?e.registerComponent(i,r):t(i,r))};
|
|
2
|
+
//# sourceMappingURL=plasmic-intercom.cjs.production.min.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plasmic-intercom.cjs.production.min.js","sources":["../src/intercom.tsx","../src/index.tsx"],"sourcesContent":["import {\n ComponentMeta,\n} from \"@plasmicapp/host\";\n\nimport { IntercomProvider as Provider } from 'react-use-intercom'\nimport React from \"react\";\n\nexport function ensure<T>(x: T | null | undefined): T {\n if (x === null || x === undefined) {\n debugger;\n throw new Error(`Value must not be undefined or null`);\n } else {\n return x;\n }\n}\n\nconst modulePath = \"@plasmicpkgs/plasmic-intercom\";\n\ninterface IntercomProviderProps {\n workSpaceId?: string\n autoBoot?: boolean,\n buttonText?: string,\n shouldInitialize?: boolean,\n apiBase?: string,\n initializeDelay?: number\n className?: string;\n}\nexport const IntercomProviderMeta: ComponentMeta<IntercomProviderProps> = {\n name: \"IntercomProvider\",\n displayName: \"Intercom Provider\",\n importName: \"IntercomProvider\",\n importPath: modulePath,\n providesData: true,\n props: {\n workSpaceId: {\n type: \"string\",\n displayName: \"Workspace ID\",\n description: \"ID of your workspace\",\n helpText:\"The easiest way to find your workspace ID is to check the URL of any page you have open in Intercom. It's the code that comes after apps/ in the URL.\"\n },\n shouldInitialize: {\n type: \"boolean\",\n displayName: \"Intercom Initialize\",\n description: \"indicates if the Intercom should be initialized. Can be used in multistaged environment\"\n },\n initializeDelay: {\n type: \"number\",\n displayName: \"Delay\",\n description: \"Indicates if the intercom initialization should be delayed, delay is in ms, defaults to 0\"\n\n },\n apiBase: {\n type: \"string\",\n displayName: \"Api Base\",\n description: \"If you need to route your Messenger requests through a different endpoint than the default. Generally speaking, this is not need\"\n }\n },\n};\n\nexport function IntercomProvider({\n apiBase,\n shouldInitialize,\n initializeDelay,\n workSpaceId\n}: IntercomProviderProps) {\n \n if (!workSpaceId) {\n return <div>Please enter your Workspace ID</div>\n }\n\n return (\n <Provider appId={workSpaceId} autoBoot apiBase={apiBase} shouldInitialize={shouldInitialize} initializeDelay={initializeDelay}>\n </Provider>\n )\n}\n\n","import registerComponent, {\n ComponentMeta,\n} from \"@plasmicapp/host/registerComponent\";\nimport registerGlobalContext from \"@plasmicapp/host/registerGlobalContext\";\nimport {\n IntercomProvider,\n IntercomProviderMeta,\n\n} from \"./intercom\";\n\nexport function registerAll(loader?: {\n registerComponent: typeof registerComponent;\n registerGlobalContext: typeof registerGlobalContext;\n}) {\n const _registerComponent = <T extends React.ComponentType<any>>(\n Component: T,\n defaultMeta: ComponentMeta<React.ComponentProps<T>>\n ) => {\n if (loader) {\n loader.registerComponent(Component, defaultMeta);\n } else {\n registerComponent(Component, defaultMeta);\n }\n };\n\n if (loader) {\n _registerComponent(IntercomProvider, IntercomProviderMeta);\n }\n}\n\nexport * from \"./intercom\";\n"],"names":["IntercomProviderMeta","name","displayName","importName","importPath","providesData","props","workSpaceId","type","description","helpText","shouldInitialize","initializeDelay","apiBase","IntercomProvider","React","Provider","appId","autoBoot","x","Error","loader","Component","defaultMeta","registerComponent"],"mappings":"uPA2BaA,EAA6D,CACxEC,KAAM,mBACNC,YAAa,oBACbC,WAAY,mBACZC,WAfiB,gCAgBjBC,cAAc,EACdC,MAAO,CACLC,YAAa,CACXC,KAAM,SACNN,YAAa,eACbO,YAAa,uBACbC,SAAS,yJAEXC,iBAAkB,CAChBH,KAAM,UACNN,YAAa,sBACbO,YAAa,2FAEfG,gBAAiB,CACfJ,KAAM,SACNN,YAAa,QACbO,YAAa,6FAGfI,QAAS,CACPL,KAAM,SACNN,YAAa,WACbO,YAAa,+IAKHK,SAIdP,IAAAA,YAGA,OAAKA,EAKHQ,gBAACC,oBAASC,MAAOV,EAAaW,YAASL,UAXzCA,QAW2DF,mBAV3DA,iBAU+FC,kBAT/FA,kBAKSG,+IA5DeI,GACxB,GAAIA,MAAAA,EAEF,MAAM,IAAIC,6CAEV,OAAOD,gCCFiBE,GAI1B,IACEC,EACAC,EASEF,IAVFC,EAWmBR,EAVnBS,EAUqCvB,EARjCqB,EACFA,EAAOG,kBAAkBF,EAAWC,GAEpCC,EAAkBF,EAAWC"}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import registerComponent from '@plasmicapp/host/registerComponent';
|
|
2
|
+
import { IntercomProvider as IntercomProvider$1 } from 'react-use-intercom';
|
|
3
|
+
import React from 'react';
|
|
4
|
+
|
|
5
|
+
function ensure(x) {
|
|
6
|
+
if (x === null || x === undefined) {
|
|
7
|
+
debugger;
|
|
8
|
+
throw new Error("Value must not be undefined or null");
|
|
9
|
+
} else {
|
|
10
|
+
return x;
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
var modulePath = "@plasmicpkgs/plasmic-intercom";
|
|
14
|
+
var IntercomProviderMeta = {
|
|
15
|
+
name: "IntercomProvider",
|
|
16
|
+
displayName: "Intercom Provider",
|
|
17
|
+
importName: "IntercomProvider",
|
|
18
|
+
importPath: modulePath,
|
|
19
|
+
providesData: true,
|
|
20
|
+
props: {
|
|
21
|
+
workSpaceId: {
|
|
22
|
+
type: "string",
|
|
23
|
+
displayName: "Workspace ID",
|
|
24
|
+
description: "ID of your workspace",
|
|
25
|
+
helpText: "The easiest way to find your workspace ID is to check the URL of any page you have open in Intercom. It's the code that comes after apps/ in the URL."
|
|
26
|
+
},
|
|
27
|
+
shouldInitialize: {
|
|
28
|
+
type: "boolean",
|
|
29
|
+
displayName: "Intercom Initialize",
|
|
30
|
+
description: "indicates if the Intercom should be initialized. Can be used in multistaged environment"
|
|
31
|
+
},
|
|
32
|
+
initializeDelay: {
|
|
33
|
+
type: "number",
|
|
34
|
+
displayName: "Delay",
|
|
35
|
+
description: "Indicates if the intercom initialization should be delayed, delay is in ms, defaults to 0"
|
|
36
|
+
},
|
|
37
|
+
apiBase: {
|
|
38
|
+
type: "string",
|
|
39
|
+
displayName: "Api Base",
|
|
40
|
+
description: "If you need to route your Messenger requests through a different endpoint than the default. Generally speaking, this is not need"
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
};
|
|
44
|
+
function IntercomProvider(_ref) {
|
|
45
|
+
var apiBase = _ref.apiBase,
|
|
46
|
+
shouldInitialize = _ref.shouldInitialize,
|
|
47
|
+
initializeDelay = _ref.initializeDelay,
|
|
48
|
+
workSpaceId = _ref.workSpaceId;
|
|
49
|
+
if (!workSpaceId) {
|
|
50
|
+
return React.createElement("div", null, "Please enter your Workspace ID");
|
|
51
|
+
}
|
|
52
|
+
return React.createElement(IntercomProvider$1, {
|
|
53
|
+
appId: workSpaceId,
|
|
54
|
+
autoBoot: true,
|
|
55
|
+
apiBase: apiBase,
|
|
56
|
+
shouldInitialize: shouldInitialize,
|
|
57
|
+
initializeDelay: initializeDelay
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
function registerAll(loader) {
|
|
62
|
+
var _registerComponent = function _registerComponent(Component, defaultMeta) {
|
|
63
|
+
if (loader) {
|
|
64
|
+
loader.registerComponent(Component, defaultMeta);
|
|
65
|
+
} else {
|
|
66
|
+
registerComponent(Component, defaultMeta);
|
|
67
|
+
}
|
|
68
|
+
};
|
|
69
|
+
if (loader) {
|
|
70
|
+
_registerComponent(IntercomProvider, IntercomProviderMeta);
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
export { IntercomProvider, IntercomProviderMeta, ensure, registerAll };
|
|
75
|
+
//# sourceMappingURL=plasmic-intercom.esm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plasmic-intercom.esm.js","sources":["../src/intercom.tsx","../src/index.tsx"],"sourcesContent":["import {\n ComponentMeta,\n} from \"@plasmicapp/host\";\n\nimport { IntercomProvider as Provider } from 'react-use-intercom'\nimport React from \"react\";\n\nexport function ensure<T>(x: T | null | undefined): T {\n if (x === null || x === undefined) {\n debugger;\n throw new Error(`Value must not be undefined or null`);\n } else {\n return x;\n }\n}\n\nconst modulePath = \"@plasmicpkgs/plasmic-intercom\";\n\ninterface IntercomProviderProps {\n workSpaceId?: string\n autoBoot?: boolean,\n buttonText?: string,\n shouldInitialize?: boolean,\n apiBase?: string,\n initializeDelay?: number\n className?: string;\n}\nexport const IntercomProviderMeta: ComponentMeta<IntercomProviderProps> = {\n name: \"IntercomProvider\",\n displayName: \"Intercom Provider\",\n importName: \"IntercomProvider\",\n importPath: modulePath,\n providesData: true,\n props: {\n workSpaceId: {\n type: \"string\",\n displayName: \"Workspace ID\",\n description: \"ID of your workspace\",\n helpText:\"The easiest way to find your workspace ID is to check the URL of any page you have open in Intercom. It's the code that comes after apps/ in the URL.\"\n },\n shouldInitialize: {\n type: \"boolean\",\n displayName: \"Intercom Initialize\",\n description: \"indicates if the Intercom should be initialized. Can be used in multistaged environment\"\n },\n initializeDelay: {\n type: \"number\",\n displayName: \"Delay\",\n description: \"Indicates if the intercom initialization should be delayed, delay is in ms, defaults to 0\"\n\n },\n apiBase: {\n type: \"string\",\n displayName: \"Api Base\",\n description: \"If you need to route your Messenger requests through a different endpoint than the default. Generally speaking, this is not need\"\n }\n },\n};\n\nexport function IntercomProvider({\n apiBase,\n shouldInitialize,\n initializeDelay,\n workSpaceId\n}: IntercomProviderProps) {\n \n if (!workSpaceId) {\n return <div>Please enter your Workspace ID</div>\n }\n\n return (\n <Provider appId={workSpaceId} autoBoot apiBase={apiBase} shouldInitialize={shouldInitialize} initializeDelay={initializeDelay}>\n </Provider>\n )\n}\n\n","import registerComponent, {\n ComponentMeta,\n} from \"@plasmicapp/host/registerComponent\";\nimport registerGlobalContext from \"@plasmicapp/host/registerGlobalContext\";\nimport {\n IntercomProvider,\n IntercomProviderMeta,\n\n} from \"./intercom\";\n\nexport function registerAll(loader?: {\n registerComponent: typeof registerComponent;\n registerGlobalContext: typeof registerGlobalContext;\n}) {\n const _registerComponent = <T extends React.ComponentType<any>>(\n Component: T,\n defaultMeta: ComponentMeta<React.ComponentProps<T>>\n ) => {\n if (loader) {\n loader.registerComponent(Component, defaultMeta);\n } else {\n registerComponent(Component, defaultMeta);\n }\n };\n\n if (loader) {\n _registerComponent(IntercomProvider, IntercomProviderMeta);\n }\n}\n\nexport * from \"./intercom\";\n"],"names":["ensure","x","undefined","Error","modulePath","IntercomProviderMeta","name","displayName","importName","importPath","providesData","props","workSpaceId","type","description","helpText","shouldInitialize","initializeDelay","apiBase","IntercomProvider","React","Provider","appId","autoBoot","registerAll","loader","_registerComponent","Component","defaultMeta","registerComponent"],"mappings":";;;;SAOgBA,MAAM,CAAIC,CAAuB;EAC/C,IAAIA,CAAC,KAAK,IAAI,IAAIA,CAAC,KAAKC,SAAS,EAAE;IACjC;IACA,MAAM,IAAIC,KAAK,uCAAuC;GACvD,MAAM;IACL,OAAOF,CAAC;;AAEZ;AAEA,IAAMG,UAAU,GAAG,+BAA+B;IAWrCC,oBAAoB,GAAyC;EACxEC,IAAI,EAAE,kBAAkB;EACxBC,WAAW,EAAE,mBAAmB;EAChCC,UAAU,EAAE,kBAAkB;EAC9BC,UAAU,EAAEL,UAAU;EACtBM,YAAY,EAAE,IAAI;EAClBC,KAAK,EAAE;IACLC,WAAW,EAAE;MACXC,IAAI,EAAE,QAAQ;MACdN,WAAW,EAAE,cAAc;MAC3BO,WAAW,EAAE,sBAAsB;MACnCC,QAAQ,EAAC;KACV;IACDC,gBAAgB,EAAE;MAChBH,IAAI,EAAE,SAAS;MACfN,WAAW,EAAE,qBAAqB;MAClCO,WAAW,EAAE;KACd;IACDG,eAAe,EAAE;MACfJ,IAAI,EAAE,QAAQ;MACdN,WAAW,EAAE,OAAO;MACpBO,WAAW,EAAE;KAEd;IACDI,OAAO,EAAE;MACPL,IAAI,EAAE,QAAQ;MACdN,WAAW,EAAE,UAAU;MACvBO,WAAW,EAAE;;;;SAKHK,gBAAgB;MAC9BD,OAAO,QAAPA,OAAO;IACPF,gBAAgB,QAAhBA,gBAAgB;IAChBC,eAAe,QAAfA,eAAe;IACfL,WAAW,QAAXA,WAAW;EAGX,IAAI,CAACA,WAAW,EAAE;IAChB,OAAOQ,kEAAyC;;EAGlD,OACEA,oBAACC,kBAAQ;IAACC,KAAK,EAAEV,WAAW;IAAEW,QAAQ;IAACL,OAAO,EAAEA,OAAO;IAAEF,gBAAgB,EAAEA,gBAAgB;IAAEC,eAAe,EAAEA;IACnG;AAEf;;SChEgBO,WAAW,CAACC,MAG3B;EACC,IAAMC,kBAAkB,GAAG,SAArBA,kBAAkB,CACtBC,SAAY,EACZC,WAAmD;IAEnD,IAAIH,MAAM,EAAE;MACVA,MAAM,CAACI,iBAAiB,CAACF,SAAS,EAAEC,WAAW,CAAC;KACjD,MAAM;MACLC,iBAAiB,CAACF,SAAS,EAAEC,WAAW,CAAC;;GAE5C;EAED,IAAIH,MAAM,EAAE;IACVC,kBAAkB,CAACP,gBAAgB,EAAEd,oBAAoB,CAAC;;AAE9D;;;;"}
|
package/package.json
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@plasmicpkgs/plasmic-intercom",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"description": "Plasmic intercom components.",
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"typings": "dist/index.d.ts",
|
|
7
|
+
"module": "dist/plasmic-intercom.esm.js",
|
|
8
|
+
"publishConfig": {
|
|
9
|
+
"access": "public"
|
|
10
|
+
},
|
|
11
|
+
"files": [
|
|
12
|
+
"dist"
|
|
13
|
+
],
|
|
14
|
+
"scripts": {
|
|
15
|
+
"start": "tsdx watch",
|
|
16
|
+
"build": "tsdx build",
|
|
17
|
+
"test": "yarn --cwd=../.. test --passWithNoTests",
|
|
18
|
+
"lint": "tsdx lint",
|
|
19
|
+
"prepare": "if-env PREPARE_NO_BUILD=true || yarn build",
|
|
20
|
+
"size": "size-limit",
|
|
21
|
+
"analyze": "size-limit --why"
|
|
22
|
+
},
|
|
23
|
+
"peerDependencies": {
|
|
24
|
+
"react": ">=16"
|
|
25
|
+
},
|
|
26
|
+
"size-limit": [
|
|
27
|
+
{
|
|
28
|
+
"path": "dist/plasmic-intercom.cjs.production.min.js",
|
|
29
|
+
"limit": "10 KB"
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
"path": "dist/plasmic-intercom.esm.js",
|
|
33
|
+
"limit": "10 KB"
|
|
34
|
+
}
|
|
35
|
+
],
|
|
36
|
+
"devDependencies": {
|
|
37
|
+
"@plasmicapp/host": "^1.0.100",
|
|
38
|
+
"@size-limit/preset-small-lib": "^7.0.8",
|
|
39
|
+
"@types/react": "^17.0.43",
|
|
40
|
+
"@types/react-dom": "^17.0.14",
|
|
41
|
+
"husky": "^7.0.4",
|
|
42
|
+
"react": "^18.0.0",
|
|
43
|
+
"react-dom": "^18.0.0",
|
|
44
|
+
"size-limit": "^7.0.8",
|
|
45
|
+
"tsdx": "^0.14.1",
|
|
46
|
+
"tslib": "^2.3.1"
|
|
47
|
+
},
|
|
48
|
+
"dependencies": {
|
|
49
|
+
"react-use-intercom": "^2.0.0"
|
|
50
|
+
},
|
|
51
|
+
"gitHead": "6a7364c3fd0b59099a5869f3e99f13b51a391d0a"
|
|
52
|
+
}
|