@bigbinary/neeto-molecules 1.0.36 → 1.0.37

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bigbinary/neeto-molecules",
3
- "version": "1.0.36",
3
+ "version": "1.0.37",
4
4
  "description": "A package of reusable molecular components for neeto products.",
5
5
  "repository": "git@github.com:bigbinary/neeto-molecules.git",
6
6
  "author": "Amaljith K <amaljith.k@bigbinary.com>",
@@ -297,10 +297,17 @@
297
297
  "regenerateUrl": {
298
298
  "title": "Regenerate URL",
299
299
  "inputLabel": "Your current URL is given below",
300
- "description": "Once a new URL is generated then the current URL will stop working. You will see the new URL once you click on the 'Yes, regenerate' button.",
301
- "confirmation": "Are you sure that you want to generate a new URL?",
302
- "submitButtonLabel": "Yes, regenerate",
303
- "cancelButtonLabel": "No, cancel"
300
+ "description": "Once a new URL is generated then the current URL will stop working. This can't be undone.",
301
+ "submitButtonLabel": "Regenerate URL",
302
+ "cancelButtonLabel": "Cancel"
303
+ },
304
+ "editUrl": {
305
+ "title": "Edit URL",
306
+ "inputLabel": "URL",
307
+ "description": "Once this URL is edited, the current URL will stop working. This can't be undone.",
308
+ "submitButtonLabel": "Submit",
309
+ "cancelButtonLabel": "Cancel",
310
+ "validationError": "Please enter a valid path without special characters, except '/', '-' and '_'."
304
311
  },
305
312
  "socialMediaShare": {
306
313
  "title": "Share via social media",
@@ -18,18 +18,47 @@ import React from "react";
18
18
  *
19
19
  * return (
20
20
  * <ShareViaLink
21
- * enableRegenerateUrl
21
+ * enabledOptions={{ regenerate: true }}
22
22
  * entity={quiz}
23
23
  * entityName="quiz"
24
24
  * handleRegenerate={regenerateURL}
25
- * isRegenerating={isRegenerating}
25
+ * isLoading={isRegenerating}
26
26
  * socialMediaPostTitle="Hi, can you please attend this quiz?"
27
27
  * url={quizUrl}
28
28
  * />
29
29
  * );
30
30
  * };
31
31
  * @endexample
32
- * Regenerate URL disabled
32
+ * Regenerate URL and Edit URL enabled
33
+ *
34
+ * @example
35
+ *
36
+ * import { useRegenerateUrl, useUpdateUrl } from "hooks/reactQuery/useQuizzesApi";
37
+ * import ShareViaLink from "@bigbinary/neeto-molecules/ShareViaLink";
38
+ *
39
+ * const Share = ({ quiz }) => {
40
+ * const { mutate: regenerateURL, isLoading: isRegenerating } =
41
+ * useRegenerateUrl();
42
+ *
43
+ * const { mutate: updateUrl, isLoading: isUpdating } =
44
+ * useUpdateUrl();
45
+ *
46
+ * return (
47
+ * <ShareViaLink
48
+ * editUrlProps={{ prefix: `${window.location.origin}/`, editablePath: window.location.pathname }}
49
+ * enabledOptions={{ regenerate: true, edit: true }}
50
+ * entity={quiz}
51
+ * entityName="quiz"
52
+ * handleEdit={updateUrl}
53
+ * handleRegenerate={regenerateURL}
54
+ * isLoading={isRegenerating || isUpdating}
55
+ * socialMediaPostTitle="Hi, can you please attend this quiz?"
56
+ * url={quizUrl}
57
+ * />
58
+ * );
59
+ * };
60
+ * @endexample
61
+ * Regenerate URL and Edit URL disabled
33
62
  *
34
63
  * @example
35
64
  *
@@ -62,13 +91,22 @@ import React from "react";
62
91
  * @endexample
63
92
  */
64
93
  const ShareViaLink: React.FC<{
65
- isRegenerating?: boolean;
66
- enableRegenerateUrl?: boolean;
94
+ isLoading?: boolean;
95
+ editUrlProps?: {
96
+ prefix?: string;
97
+ editablePath?: string;
98
+ maxLength?: number;
99
+ };
100
+ enabledOptions?: {
101
+ regenerate?: boolean;
102
+ edit?: boolean;
103
+ };
67
104
  entity: {
68
105
  id: string;
69
106
  name: string;
70
107
  };
71
108
  entityName: string;
109
+ handleEdit?: Function;
72
110
  handleRegenerate?: Function;
73
111
  previewUrl?: string;
74
112
  socialMediaPostTitle: string;