@fajarmaulana/komerce-lp-helper 0.3.0 → 0.3.1

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.
@@ -47,7 +47,9 @@ export declare const isNotPrimitive: (value: unknown) => value is object;
47
47
  * Get WhatsApp url by message and phone number if urlOnly = true, or open the url in new window.
48
48
  *
49
49
  * @param message - message.
50
- * @param urlOnly - get WhatsApp if true, open url in new window otherwise.
51
- * @param phoneNumber - the target number.
50
+ * @param options - configuration options.
52
51
  */
53
- export declare const toWA: (message?: string, urlOnly?: boolean, phoneNumber?: string) => string | undefined;
52
+ export declare const toWA: (message?: string, options?: {
53
+ urlOnly?: boolean;
54
+ phoneNumber?: string;
55
+ }) => string | undefined;
@@ -77,10 +77,10 @@ export const isNotPrimitive = (value) => {
77
77
  * Get WhatsApp url by message and phone number if urlOnly = true, or open the url in new window.
78
78
  *
79
79
  * @param message - message.
80
- * @param urlOnly - get WhatsApp if true, open url in new window otherwise.
81
- * @param phoneNumber - the target number.
80
+ * @param options - configuration options.
82
81
  */
83
- export const toWA = (message = '', urlOnly = true, phoneNumber = '6283129733705') => {
82
+ export const toWA = (message = '', options = {}) => {
83
+ const { urlOnly = true, phoneNumber = '6283129733705' } = options;
84
84
  const whatsappUrl = `https://wa.me/${phoneNumber}${message ? `?text=${encodeURIComponent(message)}` : ''}`;
85
85
  if (urlOnly)
86
86
  return whatsappUrl;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fajarmaulana/komerce-lp-helper",
3
- "version": "0.3.0",
3
+ "version": "0.3.1",
4
4
  "description": "Helper functions, hooks, and utils for Komerce LP",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",