@pixeasy/customizer 0.0.0 → 0.0.2-beta.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.
package/LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ Pixeasy Customizer SDK License
2
+
3
+ Copyright (c) Pixeasy.
4
+ All rights reserved.
5
+
6
+ Permission is hereby granted to any person obtaining a copy of this software and
7
+ associated documentation files (the "Software") to use the Software for internal
8
+ evaluation and integration with authorized Pixeasy services only.
9
+
10
+ Any redistribution, sublicensing, sale, modification for redistribution, or
11
+ public hosting of the Software is prohibited unless expressly authorized in
12
+ writing by Pixeasy.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16
+ FITNESS FOR A PARTICULAR PURPOSE, AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
17
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES, OR OTHER
18
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT, OR OTHERWISE, ARISING FROM,
19
+ OUT OF, OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20
+ SOFTWARE.
package/README.md CHANGED
@@ -1,114 +1,115 @@
1
- # Pixeasy Customizer SDK
2
-
3
- Framework-agnostic SDK for embedding the Pixeasy customizer with npm/ESM imports.
4
-
5
- ## Build package artifact (local)
6
-
7
- ```bash
8
- npm run build:sdk
9
- ```
10
-
11
- This generates:
12
-
13
- - `dist/pixeasy-customizer-element/pixeasy-customizer.min.js`
14
- - `dist/pixeasy-customizer-element/pixeasy-customizer.css`
15
- - `dist/npm` (installable npm package output)
16
-
17
- ## Install from local file output
18
-
19
- ```bash
20
- npm install @pixeasy/customizer@file:../customizer/dist/npm
21
- ```
22
-
23
- ## Exports
24
-
25
- - `createPixeasyBuilder()`
26
- - `PixeasyBuilder`
27
- - `definePixeasyCustomizerElement()`
28
- - typed events and options (`PixeasyOpenOptions`, `ManifestLoadedEventDetail`, etc.)
29
- - styles entry: `@pixeasy/customizer/styles.css`
30
-
31
- ## Angular usage
32
-
33
- ```ts
34
- import { createPixeasyBuilder } from '@pixeasy/customizer';
35
- import '@pixeasy/customizer/styles.css';
36
-
37
- const builder = createPixeasyBuilder();
38
- builder
39
- .open({
40
- container: 'pixeasyBuidler',
41
- apiKey: 'dk_xxx_yyy',
42
- productId: 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx',
43
- manifestUrl: 'https://localhost:8000/api/products/{productId}/manifest?useCdnUrl=true',
44
- })
45
- .on('sdk-ready', (event) => console.log(event.productId))
46
- .on('design:created', (event) => console.log(event.data.designs));
47
- ```
48
-
49
- ## React usage
50
-
51
- ```tsx
52
- import { useEffect } from 'react';
53
- import { createPixeasyBuilder } from '@pixeasy/customizer';
54
- import '@pixeasy/customizer/styles.css';
55
-
56
- export function CustomizerHost() {
57
- useEffect(() => {
58
- const builder = createPixeasyBuilder();
59
- builder.open({
60
- container: 'pixeasyBuidler',
61
- apiKey: 'dk_xxx_yyy',
62
- productId: 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx',
63
- manifestUrl: 'https://localhost:8000/api/products/{productId}/manifest?useCdnUrl=true',
64
- });
65
- return () => builder.close();
66
- }, []);
67
-
68
- return <div id="pixeasyBuidler" />;
69
- }
70
- ```
71
-
72
- ## Vue usage
73
-
74
- ```ts
75
- import { onMounted, onBeforeUnmount } from 'vue';
76
- import { createPixeasyBuilder } from '@pixeasy/customizer';
77
- import '@pixeasy/customizer/styles.css';
78
-
79
- const builder = createPixeasyBuilder();
80
-
81
- onMounted(() => {
82
- builder.open({
83
- container: 'pixeasyBuidler',
84
- apiKey: 'dk_xxx_yyy',
85
- productId: 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx',
86
- manifestUrl: 'https://localhost:8000/api/products/{productId}/manifest?useCdnUrl=true',
87
- });
88
- });
89
-
90
- onBeforeUnmount(() => builder.close());
91
- ```
92
-
93
- ## Plain ESM usage
94
-
95
- ```html
96
- <div id="pixeasyBuidler"></div>
97
- <script type="module">
98
- import { createPixeasyBuilder } from '/node_modules/@pixeasy/customizer/pixeasy-customizer.min.js';
99
-
100
- const builder = createPixeasyBuilder();
101
- builder.open({
102
- container: 'pixeasyBuidler',
103
- apiKey: 'dk_xxx_yyy',
104
- productId: 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx',
105
- manifestUrl: 'https://localhost:8000/api/products/{productId}/manifest?useCdnUrl=true',
106
- });
107
- </script>
108
- ```
109
-
110
- ## Migration note
111
-
112
- `window.pixeasy_builder` has been removed.
113
-
114
- Use ESM import-based integration only.
1
+ # Pixeasy Customizer SDK
2
+
3
+ Framework-agnostic SDK to embed the Pixeasy customizer in Angular, React, Vue, or any ESM app.
4
+
5
+ ## Install
6
+
7
+ ```bash
8
+ npm install @pixeasy/customizer
9
+ ```
10
+
11
+ ## Quick start
12
+
13
+ ```ts
14
+ import { createPixeasyBuilder } from '@pixeasy/customizer';
15
+ import '@pixeasy/customizer/styles.css';
16
+
17
+ const builder = createPixeasyBuilder();
18
+
19
+ builder.open({
20
+ container: 'pixeasyBuilder',
21
+ apiKey: 'dk_xxx_yyy',
22
+ productId: 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx',
23
+ });
24
+ ```
25
+
26
+ `container` can be an element id (`string`) or an `HTMLElement`.
27
+
28
+ ## API
29
+
30
+ ### `createPixeasyBuilder()`
31
+
32
+ Returns an instance of `PixeasyBuilder`.
33
+
34
+ ### `PixeasyBuilder.open(options)`
35
+
36
+ ```ts
37
+ type PixeasyOpenOptions = {
38
+ container: string | HTMLElement;
39
+ apiKey: string;
40
+ productId: string;
41
+ locale?: string;
42
+ theme?: string;
43
+ readonly?: boolean;
44
+ };
45
+ ```
46
+
47
+ ### `PixeasyBuilder` events
48
+
49
+ - `manifest-loaded`
50
+ - `sdk-ready`
51
+ - `design-change`
52
+ - `design:created`
53
+ - `error`
54
+ - `closed`
55
+
56
+ Usage:
57
+
58
+ ```ts
59
+ builder
60
+ .on('sdk-ready', (event) => console.log(event.productId))
61
+ .on('design:created', (event) => console.log(event.data.designs))
62
+ .on('error', (event) => console.error(event.code, event.message));
63
+ ```
64
+
65
+ ## Framework examples
66
+
67
+ ### React
68
+
69
+ ```tsx
70
+ import { useEffect } from 'react';
71
+ import { createPixeasyBuilder } from '@pixeasy/customizer';
72
+ import '@pixeasy/customizer/styles.css';
73
+
74
+ export function CustomizerHost() {
75
+ useEffect(() => {
76
+ const builder = createPixeasyBuilder();
77
+ builder.open({
78
+ container: 'pixeasyBuilder',
79
+ apiKey: 'dk_xxx_yyy',
80
+ productId: 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx',
81
+ });
82
+ return () => builder.close();
83
+ }, []);
84
+
85
+ return <div id="pixeasyBuilder" />;
86
+ }
87
+ ```
88
+
89
+ ### Vue
90
+
91
+ ```ts
92
+ import { onMounted, onBeforeUnmount } from 'vue';
93
+ import { createPixeasyBuilder } from '@pixeasy/customizer';
94
+ import '@pixeasy/customizer/styles.css';
95
+
96
+ const builder = createPixeasyBuilder();
97
+
98
+ onMounted(() => {
99
+ builder.open({
100
+ container: 'pixeasyBuilder',
101
+ apiKey: 'dk_xxx_yyy',
102
+ productId: 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx',
103
+ });
104
+ });
105
+
106
+ onBeforeUnmount(() => builder.close());
107
+ ```
108
+
109
+ ## Exports
110
+
111
+ - `createPixeasyBuilder`
112
+ - `PixeasyBuilder`
113
+ - `definePixeasyCustomizerElement`
114
+ - typed options/events (`PixeasyOpenOptions`, `ManifestLoadedEventDetail`, etc.)
115
+ - stylesheet export: `@pixeasy/customizer/styles.css`
package/package.json CHANGED
@@ -1,23 +1,33 @@
1
- {
2
- "name": "@pixeasy/customizer",
3
- "version": "0.0.0",
4
- "type": "module",
5
- "publishConfig": {
6
- "access": "public"
7
- },
8
- "main": "./pixeasy-customizer.min.js",
9
- "module": "./pixeasy-customizer.min.js",
10
- "types": "./index.d.ts",
11
- "exports": {
12
- ".": {
13
- "types": "./index.d.ts",
14
- "import": "./pixeasy-customizer.min.js",
15
- "default": "./pixeasy-customizer.min.js"
16
- },
17
- "./styles.css": "./pixeasy-customizer.css"
18
- },
19
- "sideEffects": [
20
- "./pixeasy-customizer.min.js",
21
- "./pixeasy-customizer.css"
22
- ]
1
+ {
2
+ "name": "@pixeasy/customizer",
3
+ "version": "0.0.2-beta.0",
4
+ "type": "module",
5
+ "license": "SEE LICENSE IN LICENSE",
6
+ "publishConfig": {
7
+ "access": "public"
8
+ },
9
+ "main": "./pixeasy-customizer.min.js",
10
+ "module": "./pixeasy-customizer.min.js",
11
+ "types": "./index.d.ts",
12
+ "exports": {
13
+ ".": {
14
+ "types": "./index.d.ts",
15
+ "import": "./pixeasy-customizer.min.js",
16
+ "default": "./pixeasy-customizer.min.js"
17
+ },
18
+ "./styles.css": "./pixeasy-customizer.css"
19
+ },
20
+ "sideEffects": [
21
+ "./pixeasy-customizer.min.js",
22
+ "./pixeasy-customizer.css"
23
+ ],
24
+ "files": [
25
+ "pixeasy-customizer.min.js",
26
+ "pixeasy-customizer.css",
27
+ "index.d.ts",
28
+ "README.md",
29
+ "LICENSE",
30
+ "assets",
31
+ "media"
32
+ ]
23
33
  }