react-pdf-editor-1 1.2.49 → 1.2.51

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/dist/index.js CHANGED
@@ -110,6 +110,7 @@ var useCreateIframeAndLoadViewer = function useCreateIframeAndLoadViewer(_ref) {
110
110
  mode: mode,
111
111
  uuid: uuid,
112
112
  customData: customData,
113
+ purpose: customData === null || customData === void 0 ? void 0 : customData.purpose,
113
114
  initialAnnotations: initialAnnotations,
114
115
  notarySeal: notarySeal,
115
116
  initialSigners: initialSigners,
@@ -120,6 +121,12 @@ var useCreateIframeAndLoadViewer = function useCreateIframeAndLoadViewer(_ref) {
120
121
  hideUndoRedoButtons: hideUndoRedoButtons,
121
122
  role: role
122
123
  };
124
+ console.log('[react-pdf-sdk] posting init message to pdf-view', {
125
+ mode: mode,
126
+ hasCustomData: Boolean(customData),
127
+ customDataPurpose: customData === null || customData === void 0 ? void 0 : customData.purpose,
128
+ rootPurpose: message.purpose
129
+ });
123
130
  if (typeof notaryStamp !== 'undefined') {
124
131
  message.notaryStamp = notaryStamp;
125
132
  }
@@ -138,7 +145,7 @@ var useCreateIframeAndLoadViewer = function useCreateIframeAndLoadViewer(_ref) {
138
145
 
139
146
  // Set up an event listener to listen for a response from the iframe
140
147
  window.parent.addEventListener('message', function (event) {
141
- var _event$data, _event$data2;
148
+ var _event$data, _event$data2, _event$data3;
142
149
  if (event.data.type === 'file-received' && event.data.success) {
143
150
  // If the message was received successfully, clear the interval
144
151
  clearInterval(interval);
@@ -201,6 +208,14 @@ var useCreateIframeAndLoadViewer = function useCreateIframeAndLoadViewer(_ref) {
201
208
  }
202
209
  });
203
210
  }
211
+ if (((_event$data3 = event.data) === null || _event$data3 === void 0 ? void 0 : _event$data3.type) === 'active-document-change') {
212
+ console.log('[react-pdf-sdk] received active-document-change', {
213
+ payload: event.data.message
214
+ });
215
+ window.dispatchEvent(new CustomEvent('pdf-active-document-change', {
216
+ detail: event.data.message
217
+ }));
218
+ }
204
219
  });
205
220
  };
206
221
  container.current.appendChild(iframe);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-pdf-editor-1",
3
- "version": "1.2.49",
3
+ "version": "1.2.51",
4
4
  "description": "## Core",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {
package/src/index.js CHANGED
@@ -61,7 +61,14 @@ export const useCreateIframeAndLoadViewer = ({
61
61
  // When the iframe is loaded, post the file to it
62
62
  iframe.onload = function() {
63
63
  const targetOrigin = window.location.origin;
64
- const message = { files, fileName, tools, locale, licenseKey, mode, uuid, customData, initialAnnotations, notarySeal, initialSigners, modifiedUiElements, authInfo, defaultAnnotationEditorMode, textTagDefaults, hideUndoRedoButtons, role };
64
+ const message = { files, fileName, tools, locale, licenseKey, mode, uuid, customData, purpose: customData?.purpose, initialAnnotations, notarySeal, initialSigners, modifiedUiElements, authInfo, defaultAnnotationEditorMode, textTagDefaults, hideUndoRedoButtons, role };
65
+
66
+ console.log('[react-pdf-sdk] posting init message to pdf-view', {
67
+ mode,
68
+ hasCustomData: Boolean(customData),
69
+ customDataPurpose: customData?.purpose,
70
+ rootPurpose: message.purpose
71
+ });
65
72
 
66
73
  if (typeof notaryStamp !== 'undefined') {
67
74
  message.notaryStamp = notaryStamp;
@@ -139,6 +146,12 @@ export const useCreateIframeAndLoadViewer = ({
139
146
  }
140
147
  });
141
148
  }
149
+ if (event.data?.type === 'active-document-change') {
150
+ console.log('[react-pdf-sdk] received active-document-change', { payload: event.data.message });
151
+ window.dispatchEvent(new CustomEvent('pdf-active-document-change', {
152
+ detail: event.data.message,
153
+ }));
154
+ }
142
155
  });
143
156
  };
144
157