@openlettermarketing/olc-react-sdk 0.0.21 → 0.0.22
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/build/index.js +7 -7
- package/build/index.js.map +1 -1
- package/build/types/App.d.ts +3 -0
- package/build/types/assets/images/templates/field.d.ts +3 -0
- package/build/types/components/GenericUIBlocks/Button/index.d.ts +1 -0
- package/build/types/components/SidePanel/index.d.ts +2 -0
- package/build/types/components/TemplateBuilder/index.d.ts +3 -2
- package/build/types/components/TopNavigation/index.d.ts +1 -0
- package/build/types/index.d.ts +4 -3
- package/build/types/redux/actions/action-types.d.ts +1 -15
- package/build/types/redux/actions/templateActions.d.ts +1 -104
- package/build/types/redux/reducers/customFieldReducer.d.ts +0 -2
- package/build/types/utils/constants.d.ts +5 -2
- package/build/types/utils/helper.d.ts +0 -4
- package/build/types/utils/message.d.ts +4 -0
- package/build/types/utils/products.d.ts +12 -0
- package/package.json +1 -2
- package/build/types/assets/images/templates/dynamic-field.d.ts +0 -3
- package/build/types/redux/actions/customFieldAction.d.ts +0 -4
package/build/types/App.d.ts
CHANGED
|
@@ -3,6 +3,9 @@ interface AppProps {
|
|
|
3
3
|
secretKey: string;
|
|
4
4
|
returnRoute?: string | null;
|
|
5
5
|
styles?: any;
|
|
6
|
+
onGetTemplates?: (payload: any) => Promise<any>;
|
|
7
|
+
onGetCustomFields?: () => Promise<any>;
|
|
8
|
+
onSubmit?: (payload: any) => Promise<any>;
|
|
6
9
|
}
|
|
7
10
|
declare const App: React.FC<AppProps>;
|
|
8
11
|
export default App;
|
|
@@ -3,6 +3,8 @@ import type { StoreType } from 'polotno/model/store';
|
|
|
3
3
|
interface Props {
|
|
4
4
|
store: StoreType;
|
|
5
5
|
currentTemplateType: string;
|
|
6
|
+
onGetTemplates?: (payload: any) => Promise<any>;
|
|
7
|
+
onGetCustomFields?: () => Promise<any>;
|
|
6
8
|
}
|
|
7
9
|
declare const SidePanel: React.FC<Props>;
|
|
8
10
|
export default SidePanel;
|
|
@@ -12,11 +12,12 @@ import './styles.scss';
|
|
|
12
12
|
* @param {Object} props.styles - The styles contain CSS Properties passed as a prop to the `TemplateBuilder` component.
|
|
13
13
|
* @returns {JSX.Element} The rendered template builder interface.
|
|
14
14
|
*/
|
|
15
|
-
import './styles.scss';
|
|
16
15
|
interface TemplateBuilderProps {
|
|
17
16
|
store: StoreType;
|
|
18
17
|
returnRoute?: string | null;
|
|
19
|
-
|
|
18
|
+
onGetCustomFields?: () => Promise<any>;
|
|
19
|
+
onGetTemplates?: (payload: any) => Promise<any>;
|
|
20
|
+
onSubmit?: (payload: any) => Promise<any>;
|
|
20
21
|
}
|
|
21
22
|
declare const TemplateBuilder: React.FC<TemplateBuilderProps>;
|
|
22
23
|
export default TemplateBuilder;
|
package/build/types/index.d.ts
CHANGED
|
@@ -6,13 +6,14 @@ import '@fontsource/inter/500.css';
|
|
|
6
6
|
import { CustomCSSProperties } from './utils/customStyles';
|
|
7
7
|
interface TemplateBuilderProps {
|
|
8
8
|
container: HTMLElement | null;
|
|
9
|
-
apiKey: string;
|
|
10
|
-
mode: 'test' | 'live';
|
|
11
9
|
secretKey: string;
|
|
12
10
|
returnRoute?: string | null;
|
|
11
|
+
onGetTemplates?: (payload: any) => Promise<any>;
|
|
12
|
+
onGetCustomFields?: () => Promise<any>;
|
|
13
|
+
onSubmit?: (payload: any) => Promise<any>;
|
|
13
14
|
styles?: {
|
|
14
15
|
root?: CustomCSSProperties;
|
|
15
16
|
};
|
|
16
17
|
}
|
|
17
|
-
declare const TemplateBuilder: ({ container,
|
|
18
|
+
declare const TemplateBuilder: ({ container, secretKey, returnRoute, onGetTemplates, onGetCustomFields, onSubmit, styles, }: TemplateBuilderProps) => void;
|
|
18
19
|
export default TemplateBuilder;
|
|
@@ -1,29 +1,15 @@
|
|
|
1
1
|
export declare const SET_SUCCESS_SNACKBAR = "SET_SUCCESS_SNACKBAR";
|
|
2
2
|
export declare const SET_ERROR_SNACKBAR = "SET_ERROR_SNACKBAR";
|
|
3
3
|
export declare const CLEAR_SNACKBAR = "CLEAR_SNACKBAR";
|
|
4
|
-
export declare const SET_DYNAMIC_FIELD_VALUE: string;
|
|
5
|
-
export declare const SET_DYNAMIC_FIELDS: string;
|
|
6
|
-
export declare const UPDATE_DYNAMIC_FIELDS: string;
|
|
7
|
-
export declare const UPDATE_CONTACT_FIELDS: string;
|
|
8
|
-
export declare const REMOVE_FROM_DYNAMIC_FIELDS: string;
|
|
9
|
-
export declare const GET_PRODUCTS: string;
|
|
10
|
-
export declare const CLEAR_DYNAMIC_FIELDS: string;
|
|
11
|
-
export declare const CLEAR_FIELDS: string;
|
|
12
|
-
export declare const GET_ALL_TEMPLATES: string;
|
|
13
4
|
export declare const GET_ONE_TEMPLATE: string;
|
|
14
5
|
export declare const TEMPLATE_LOADING: string;
|
|
15
6
|
export declare const TEMPLATE_PAGINATION_CHANGE: string;
|
|
16
7
|
export declare const TEMPLATE_SEARCH: string;
|
|
17
8
|
export declare const CLEAR_ALL_TEMPLATE: string;
|
|
18
9
|
export declare const CLEAR_TEMPLATE_FIELDS: string;
|
|
19
|
-
export declare const GET_DYNAMIC_FIELDS_FROM_SERVER: string;
|
|
20
10
|
export declare const LOAD_DATA_FROM_LOCAL_STORAGE: string;
|
|
21
11
|
export declare const CLEAR_TEMPLATE: string;
|
|
22
12
|
export declare const SELECT_PRODUCT: string;
|
|
23
13
|
export declare const SELECT_POSTCARD: string;
|
|
24
|
-
export declare const
|
|
25
|
-
export declare const SET_PRODUCT_DETAILS: string;
|
|
26
|
-
export declare const SET_PRODUCTS_DATA: string;
|
|
14
|
+
export declare const SET_CUSTOM_FIELDS = "SET_CUSTOM_FIELDS";
|
|
27
15
|
export declare const CLEAR_REDUX: string;
|
|
28
|
-
export declare const FETCH_TEMPLATES_REQUEST: string;
|
|
29
|
-
export declare const SET_TEMPLATES: string;
|
|
@@ -29,67 +29,6 @@ declare const createTemplate: (data: object) => Promise<unknown>;
|
|
|
29
29
|
* @returns {Promise<object>} - A promise that resolves to the response from the successful request or the error response if an error occurs.
|
|
30
30
|
*/
|
|
31
31
|
declare const updateTemplate: (id: number, data: object) => Promise<unknown>;
|
|
32
|
-
/**
|
|
33
|
-
* Deletes a template by its ID.
|
|
34
|
-
*
|
|
35
|
-
* @param {string} id - The unique identifier of the template to delete.
|
|
36
|
-
* @returns {Promise<any>} A Promise that resolves to the response indicating
|
|
37
|
-
* the success of the template deletion, or rejects
|
|
38
|
-
* with an error response in case of failure.
|
|
39
|
-
*
|
|
40
|
-
* @throws {Error} If the request to delete the template fails.
|
|
41
|
-
*/
|
|
42
|
-
declare const deleteTemplate: (id: string) => Promise<unknown>;
|
|
43
|
-
/**
|
|
44
|
-
* Retrieves the view proof for a template with the given ID.
|
|
45
|
-
*
|
|
46
|
-
* @param {string} id - The ID of the template for which the view proof is requested.
|
|
47
|
-
* @returns {Promise<object>} - The response object from the GET request, containing the view proof for the template with the given ID.
|
|
48
|
-
* @throws {object} - The error response if there is an error.
|
|
49
|
-
*/
|
|
50
|
-
declare const getViewProof: (id: string) => Promise<unknown>;
|
|
51
|
-
/**
|
|
52
|
-
* Duplicates a template by its ID.
|
|
53
|
-
*
|
|
54
|
-
* @param {string} id - The unique identifier of the template to duplicate.
|
|
55
|
-
* @param {Object} data - Additional data to be sent with the duplicate request.
|
|
56
|
-
* @returns {Promise<any>} A Promise that resolves to the response containing information
|
|
57
|
-
* about the duplicated template, or rejects with an error response
|
|
58
|
-
* in case of failure.
|
|
59
|
-
*
|
|
60
|
-
* @throws {Error} If the request to duplicate the template fails.
|
|
61
|
-
*/
|
|
62
|
-
declare const doublicateTemplate: (id: string, data: object) => Promise<unknown>;
|
|
63
|
-
/**
|
|
64
|
-
* Fetches products and dispatches an action with the product data to the Redux store.
|
|
65
|
-
*
|
|
66
|
-
* @param {Function} dispatch - The dispatch function from the Redux store.
|
|
67
|
-
* @returns {Promise<void>} A Promise that resolves after dispatching the action,
|
|
68
|
-
* or rejects if there is an error fetching the products.
|
|
69
|
-
*
|
|
70
|
-
* @throws {Error} If there is an error fetching the products.
|
|
71
|
-
*/
|
|
72
|
-
declare const getAllProducts: () => (dispatch: AppDispatch) => Promise<void>;
|
|
73
|
-
/**
|
|
74
|
-
* Fetches custom fields and dispatches an action with the custom fields data to the Redux store.
|
|
75
|
-
*
|
|
76
|
-
* @param {Function} dispatch - The dispatch function from the Redux store.
|
|
77
|
-
* @returns {Promise<void>} A Promise that resolves after dispatching the action,
|
|
78
|
-
* or rejects if there is an error fetching the custom fields.
|
|
79
|
-
*
|
|
80
|
-
* @throws {Error} If there is an error fetching the custom fields.
|
|
81
|
-
*/
|
|
82
|
-
declare const getAllCustomFields: () => (dispatch: AppDispatch) => Promise<void>;
|
|
83
|
-
/**
|
|
84
|
-
* Fetches product details and dispatches an action with the product details data to the Redux store.
|
|
85
|
-
*
|
|
86
|
-
* @param {object} payload - The payload containing the product details.
|
|
87
|
-
* @returns {Promise<void>} A Promise that resolves after dispatching the action,
|
|
88
|
-
* or rejects if there is an error fetching the product details.
|
|
89
|
-
*
|
|
90
|
-
* @throws {Error} If there is an error fetching the product details.
|
|
91
|
-
*/
|
|
92
|
-
declare const getProductDetails: (payload: object) => (dispatch: AppDispatch) => Promise<void>;
|
|
93
32
|
/**
|
|
94
33
|
* Loads form data to the store.
|
|
95
34
|
*
|
|
@@ -149,40 +88,6 @@ declare const clearAllTemplates: () => (dispatch: AppDispatch) => void;
|
|
|
149
88
|
* @returns {Function} - The thunk function.
|
|
150
89
|
*/
|
|
151
90
|
declare const searchAndAdvanceChange: (name: string, value: any) => (dispatch: AppDispatch) => void;
|
|
152
|
-
/**
|
|
153
|
-
* Changes dynamic input.
|
|
154
|
-
*
|
|
155
|
-
* @param {any} value - The value of the dynamic input.
|
|
156
|
-
* @returns {Function} - The thunk function.
|
|
157
|
-
*/
|
|
158
|
-
declare const dynmicInputChange: (value: any) => (dispatch: AppDispatch) => void;
|
|
159
|
-
/**
|
|
160
|
-
* Sets dynamic fields.
|
|
161
|
-
*
|
|
162
|
-
* @returns {Function} - The thunk function.
|
|
163
|
-
*/
|
|
164
|
-
declare const setDynamicFields: () => (dispatch: AppDispatch) => void;
|
|
165
|
-
/**
|
|
166
|
-
* Removes an item from dynamic fields.
|
|
167
|
-
*
|
|
168
|
-
* @param {any} value - The value of the item to remove.
|
|
169
|
-
* @returns {Function} - The thunk function.
|
|
170
|
-
*/
|
|
171
|
-
declare const removeItemFromDynamicField: (value: any) => (dispatch: AppDispatch) => void;
|
|
172
|
-
/**
|
|
173
|
-
* Clears dynamic fields.
|
|
174
|
-
*
|
|
175
|
-
* @returns {Function} - The thunk function.
|
|
176
|
-
*/
|
|
177
|
-
declare const clearDynaicFields: () => (dispatch: AppDispatch) => void;
|
|
178
|
-
/**
|
|
179
|
-
* Clears filters.
|
|
180
|
-
*
|
|
181
|
-
* @returns {Function} - The thunk function.
|
|
182
|
-
*/
|
|
183
|
-
declare const clearFilter: () => (dispatch: AppDispatch) => {
|
|
184
|
-
type: string;
|
|
185
|
-
};
|
|
186
91
|
/**
|
|
187
92
|
* Retrieves all template categories from the server using an HTTP GET request.
|
|
188
93
|
*
|
|
@@ -190,12 +95,4 @@ declare const clearFilter: () => (dispatch: AppDispatch) => {
|
|
|
190
95
|
* @throws {object} - The error response if there is an error.
|
|
191
96
|
*/
|
|
192
97
|
declare const getAllTemplateCategories: () => Promise<any>;
|
|
193
|
-
|
|
194
|
-
* Retrieves templates by tab using the provided payload.
|
|
195
|
-
*
|
|
196
|
-
* @param {object} payload - The payload containing the necessary data to filter templates by tab.
|
|
197
|
-
* @returns {Promise<any>} - A promise that resolves with the response data from the server.
|
|
198
|
-
* @throws {object} - The error response if there is an error.
|
|
199
|
-
*/
|
|
200
|
-
declare const getAllTemplatesByTab: (payload: object) => Promise<any>;
|
|
201
|
-
export { dynmicInputChange, setDynamicFields, clearDynaicFields, removeItemFromDynamicField, getAllProducts, uploadTemplate, getOneTemplate, createTemplate, updateTemplate, clearFilter, deleteTemplate, getViewProof, doublicateTemplate, searchAndAdvanceChange, clearAllTemplates, selectProduct, selectPostCard, clearTemplateFields, getAllCustomFields, loadFormDataToStore, uploadFile, getProductDetails, downloadProof, getAllTemplateCategories, getAllTemplatesByTab };
|
|
98
|
+
export { uploadTemplate, getOneTemplate, createTemplate, updateTemplate, searchAndAdvanceChange, clearAllTemplates, selectProduct, selectPostCard, clearTemplateFields, loadFormDataToStore, uploadFile, downloadProof, getAllTemplateCategories };
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
export interface CustomFieldState {
|
|
2
2
|
customFields: any[];
|
|
3
3
|
defaultDynamicFields: any[];
|
|
4
|
-
loading: boolean;
|
|
5
|
-
error: string | null;
|
|
6
4
|
}
|
|
7
5
|
declare const customFieldReducer: (state: CustomFieldState | undefined, action: any) => CustomFieldState;
|
|
8
6
|
export { customFieldReducer };
|
|
@@ -1,9 +1,12 @@
|
|
|
1
|
+
export declare const API_BASE_URL = "https://api.openletterconnect.com/api/v1";
|
|
1
2
|
export declare const DPI: number;
|
|
2
3
|
export declare const Barcode: string;
|
|
3
4
|
export declare const PRODUCT_LEARN_URL: string;
|
|
4
5
|
export declare const multiPageLetters: string[];
|
|
5
|
-
|
|
6
|
+
interface TemplateTypes {
|
|
6
7
|
id: string;
|
|
7
8
|
label: string;
|
|
8
|
-
}
|
|
9
|
+
}
|
|
10
|
+
export declare const templateTypes: TemplateTypes[];
|
|
9
11
|
export declare const sortOrderForTemplates: string[];
|
|
12
|
+
export {};
|
|
@@ -4,6 +4,10 @@ export declare const MESSAGES: {
|
|
|
4
4
|
readonly SEARCH_PLACE_HOLDER: "Search by template name or template ID";
|
|
5
5
|
readonly NAME_REQUIRED: "Template Name is required";
|
|
6
6
|
readonly TYPE_REQUIRED: "Template Type is required";
|
|
7
|
+
readonly DESIGN_NEW: "Design Your Own";
|
|
8
|
+
readonly NO_MY_TEMPLATES: "No My Templates to show";
|
|
9
|
+
readonly NO_TEAM_TEMPLATES: "No Team Templates to show";
|
|
10
|
+
readonly NO_OLC_TEMPLATES: "No OLC Templates to show";
|
|
7
11
|
readonly PRODUCT_TYPE_REQUIRED: "Product Type is required";
|
|
8
12
|
readonly ENVELOPE_TYPE_REQUIRED: "Envelope Type is required";
|
|
9
13
|
readonly POSTCARD_SIZE_REQUIRED: "Postcard Size is required";
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openlettermarketing/olc-react-sdk",
|
|
3
3
|
"private": false,
|
|
4
|
-
"version": "0.0.
|
|
4
|
+
"version": "0.0.22",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"description": "Simplify template builder integration for any product.",
|
|
7
7
|
"main": "build/index.js",
|
|
@@ -40,7 +40,6 @@
|
|
|
40
40
|
],
|
|
41
41
|
"dependencies": {
|
|
42
42
|
"@fontsource/inter": "^5.0.18",
|
|
43
|
-
"deepmerge": "^4.3.1",
|
|
44
43
|
"mobx-react-lite": "^4.0.7",
|
|
45
44
|
"polotno": "^2.4.5",
|
|
46
45
|
"react": "^18.3.1",
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import { AppDispatch } from '../store';
|
|
2
|
-
export declare const FETCH_CUSTOM_FIELDS_REQUEST = "FETCH_CUSTOM_FIELDS_REQUEST";
|
|
3
|
-
export declare const SET_CUSTOM_FIELDS = "SET_CUSTOM_FIELDS";
|
|
4
|
-
export declare const fetchCustomFields: () => (dispatch: AppDispatch) => Promise<void>;
|