@crownpeak/dqm-react-component 1.0.1 → 1.1.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.
Files changed (35) hide show
  1. package/CHANGELOG.md +25 -0
  2. package/DEVELOPMENT.md +36 -1
  3. package/EXAMPLES.md +187 -0
  4. package/QUICKSTART.md +7 -0
  5. package/README.md +75 -1
  6. package/dist/DQMSidebar.d.ts.map +1 -1
  7. package/dist/components/sidebar/CloseButton.d.ts +6 -0
  8. package/dist/components/sidebar/CloseButton.d.ts.map +1 -0
  9. package/dist/components/sidebar/SidebarContent.d.ts.map +1 -1
  10. package/dist/components/sidebar/SidebarFooter.d.ts.map +1 -1
  11. package/dist/components/sidebar/SidebarHeader.d.ts.map +1 -1
  12. package/dist/components/sidebar/SidebarSkeleton.d.ts.map +1 -1
  13. package/dist/components/sidebar/StyledDrawer.d.ts +6 -1
  14. package/dist/components/sidebar/StyledDrawer.d.ts.map +1 -1
  15. package/dist/components/sidebar/StyledFab.d.ts +4 -1
  16. package/dist/components/sidebar/StyledFab.d.ts.map +1 -1
  17. package/dist/dqm-widget.d.ts +107 -0
  18. package/dist/dqm-widget.esm.js +386 -0
  19. package/dist/dqm-widget.iife.js +132 -0
  20. package/dist/html-pages/DQMWidget.d.ts +36 -0
  21. package/dist/html-pages/DQMWidget.d.ts.map +1 -0
  22. package/dist/html-pages/index.d.ts +32 -0
  23. package/dist/html-pages/index.d.ts.map +1 -0
  24. package/dist/index.cjs +26 -26
  25. package/dist/index.cjs.map +1 -1
  26. package/dist/index.d.ts +3 -1
  27. package/dist/index.d.ts.map +1 -1
  28. package/dist/index.html +498 -0
  29. package/dist/index.js +4061 -3839
  30. package/dist/index.js.map +1 -1
  31. package/dist/types.d.ts +83 -0
  32. package/dist/types.d.ts.map +1 -1
  33. package/dist/utils/useDomPresence.d.ts +210 -0
  34. package/dist/utils/useDomPresence.d.ts.map +1 -0
  35. package/package.json +12 -3
@@ -0,0 +1,36 @@
1
+ import { default as React } from 'react';
2
+ import { Theme } from '@mui/material/styles';
3
+ import { DQMConfig } from '../types.ts';
4
+ export type { DQMConfig } from '../types.ts';
5
+ /**
6
+ * Widget configuration interface for standalone usage.
7
+ * Can be provided via window.DQM_CONFIG or passed to initDQMWidget().
8
+ */
9
+ export interface DQMWidgetConfig extends DQMConfig {
10
+ /** Initial open state of the sidebar. Default: false (or true if ?dqm=true in URL) */
11
+ initialOpen?: boolean;
12
+ }
13
+ export declare const DQMWidget: React.FC<{
14
+ theme: Theme;
15
+ }>;
16
+ /**
17
+ * Initialize the DQM Widget.
18
+ *
19
+ * @param config - Optional configuration object. Merged with window.DQM_CONFIG.
20
+ * @param providedContainer - Optional custom container element to mount into.
21
+ *
22
+ * @example
23
+ * // Via global config (before script load)
24
+ * window.DQM_CONFIG = { apiKey: 'xxx', websiteId: 'yyy' };
25
+ *
26
+ * @example
27
+ * // Via function call (ESM import)
28
+ * import { initDQMWidget } from '@crownpeak/dqm-react-component/widget';
29
+ * initDQMWidget({ apiKey: 'xxx', websiteId: 'yyy' });
30
+ *
31
+ * @example
32
+ * // Via IIFE global
33
+ * window.CrownpeakDQM.init({ apiKey: 'xxx', websiteId: 'yyy' });
34
+ */
35
+ export declare const initDQMWidget: (config?: DQMWidgetConfig, providedContainer?: HTMLElement) => void;
36
+ //# sourceMappingURL=DQMWidget.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DQMWidget.d.ts","sourceRoot":"","sources":["../../src/html-pages/DQMWidget.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,KAAK,EAAC,KAAK,EAAC,MAAM,sBAAsB,CAAC;AAQhD,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,aAAa,CAAC;AAG3C,YAAY,EAAC,SAAS,EAAC,MAAM,aAAa,CAAC;AAE3C;;;GAGG;AACH,MAAM,WAAW,eAAgB,SAAQ,SAAS;IAC9C,sFAAsF;IACtF,WAAW,CAAC,EAAE,OAAO,CAAC;CACzB;AAiGD,eAAO,MAAM,SAAS,EAAE,KAAK,CAAC,EAAE,CAAC;IAAE,KAAK,EAAE,KAAK,CAAA;CAAE,CAiChD,CAAC;AAmOF;;;;;;;;;;;;;;;;;;GAkBG;AACH,eAAO,MAAM,aAAa,GAAI,SAAS,eAAe,EAAE,oBAAoB,WAAW,KAAG,IA0EzF,CAAC"}
@@ -0,0 +1,32 @@
1
+ /**
2
+ * DQM Widget - Standalone integration for any website
3
+ *
4
+ * This module provides utilities to load and initialize the DQM widget.
5
+ *
6
+ * @packageDocumentation
7
+ */
8
+ export { initDQMWidget, DQMWidget } from './DQMWidget';
9
+ export type { DQMWidgetConfig } from './DQMWidget';
10
+ /**
11
+ * Load the DQM React widget dynamically from a URL.
12
+ *
13
+ * This is useful for platforms like Shopify where you want to load the widget
14
+ * from a CDN or API route without bundling it into your application.
15
+ *
16
+ * @param widgetUrl - Primary URL to load the widget from
17
+ * @param fallbackUrl - Fallback URL if primary fails
18
+ *
19
+ * @example
20
+ * ```js
21
+ * loadDQMWidget(
22
+ * 'https://cdn.example.com/dqm-widget.iife.js',
23
+ * 'https://backup.example.com/dqm-widget.iife.js'
24
+ * );
25
+ * ```
26
+ */
27
+ export declare function loadDQMWidget(widgetUrl: string, fallbackUrl?: string): void;
28
+ /**
29
+ * @deprecated Use `loadDQMWidget` instead. This function is kept for backwards compatibility.
30
+ */
31
+ export declare function loadMUIWidget(widgetUrl: string, fallbackUrl: string): void;
32
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/html-pages/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,OAAO,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACvD,YAAY,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAEnD;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,aAAa,CAAC,SAAS,EAAE,MAAM,EAAE,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,CA+B3E;AAED;;GAEG;AACH,wBAAgB,aAAa,CAAC,SAAS,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,GAAG,IAAI,CAgB1E"}