From 9da92fc3ce27385e95ffafc2701fe26cee7e4c62 Mon Sep 17 00:00:00 2001 From: Rodrigo Gomez Palacio Date: Wed, 18 Dec 2024 12:56:29 -0600 Subject: [PATCH 01/11] Add LICENSE --- LICENSE | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 LICENSE diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..4682002 --- /dev/null +++ b/LICENSE @@ -0,0 +1,24 @@ +Modified MIT License + +Copyright 2024 OneSignal + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +1. The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +2. All copies of substantial portions of the Software may only be used in connection +with services provided by OneSignal. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. From ff88fdf8cdc228a8edc674a7efcc3b847d9fb5d0 Mon Sep 17 00:00:00 2001 From: Rodrigo Gomez Palacio Date: Wed, 18 Dec 2024 12:56:43 -0600 Subject: [PATCH 02/11] Update package.json --- package.json | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/package.json b/package.json index c7f2345..67dd621 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "web-shim-codegen", - "version": "2.0.0", + "version": "3.0.0", "description": "Used to build Web SDK libraries for various web frameworks", "main": "index.js", "scripts": { @@ -8,9 +8,9 @@ "test": "echo \"Error: no test specified\" && exit 1", "build": "./scripts/build" }, - "keywords": [], - "author": "", - "license": "ISC", + "keywords": ["web", "sdk", "codegen"], + "author": "Rodrigo Gomez-Palacio", + "license": "MIT", "devDependencies": { "@types/node": "^18.15.0", "@typescript-eslint/eslint-plugin": "^5.54.0", From 1686bc4b5d7808c800d4128cce256dcd12fcdf64 Mon Sep 17 00:00:00 2001 From: Rodrigo Gomez Palacio Date: Wed, 18 Dec 2024 13:02:46 -0600 Subject: [PATCH 03/11] Add ISSUE_TEMPLATE directory with templates --- .github/ISSUE_TEMPLATE/ask-question.yml | 13 ++++++++ .github/ISSUE_TEMPLATE/bug-report.yml | 42 +++++++++++++++++++++++++ 2 files changed, 55 insertions(+) create mode 100644 .github/ISSUE_TEMPLATE/ask-question.yml create mode 100644 .github/ISSUE_TEMPLATE/bug-report.yml diff --git a/.github/ISSUE_TEMPLATE/ask-question.yml b/.github/ISSUE_TEMPLATE/ask-question.yml new file mode 100644 index 0000000..ea5c773 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/ask-question.yml @@ -0,0 +1,13 @@ +name: 🙋‍♂️ Ask a question +description: Tell us what's on your mind +title: '[question]: ' +labels: ['question'] +body: + - type: textarea + id: question + attributes: + label: How can we help? + description: Specific question regarding integrating this code generator. + placeholder: How do I...? + validations: + required: true diff --git a/.github/ISSUE_TEMPLATE/bug-report.yml b/.github/ISSUE_TEMPLATE/bug-report.yml new file mode 100644 index 0000000..e3984cb --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug-report.yml @@ -0,0 +1,42 @@ +name: 🪳 Bug report +description: File a bug report +title: '[Bug]: ' +labels: ['bug', 'triage'] +body: + - type: markdown + attributes: + value: | + Thanks for taking the time to fill out this bug report! + - type: textarea + id: what-happened + attributes: + label: What happened? + description: Provide a thorough description of whats going on. + placeholder: e.g. The types need to be updated + validations: + required: true + - type: textarea + id: reproduction-steps + attributes: + label: Steps to reproduce? + description: Provide as much detail as posible to reproduce the issue. + placeholder: | + 1. Modify file X + 2. Run script Y + render: Markdown + validations: + required: true + - type: textarea + id: what-are-expectations + attributes: + label: What did you expect to happen? + description: Also tell us, what did you expect to happen? + placeholder: I expected the code to generate + validations: + required: true + - type: textarea + id: logs + attributes: + label: Relevant log output + description: Please copy and paste any relevant log output. This will be automatically formatted into code, so no need for backticks. + render: Shell From c92831dff24ed178fb6d4797b963b93450c7fd10 Mon Sep 17 00:00:00 2001 From: Rodrigo Gomez Palacio Date: Wed, 18 Dec 2024 13:37:01 -0600 Subject: [PATCH 04/11] Missing space in types.ts comment --- src/snippets/types.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/snippets/types.ts b/src/snippets/types.ts index 9087443..4be47c9 100644 --- a/src/snippets/types.ts +++ b/src/snippets/types.ts @@ -70,7 +70,7 @@ export const OS_NOTIFICATION = `interface IOSNotification { * If this value is the same as existing notification, it will replace it * Can be set when creating the notification with "Web Push Topic" on the dashboard * or web_push_topic from the REST API. - */ + */ readonly topic?: string; /** From 8283f3486b71d4714e394f9e5b942a73395e3acb Mon Sep 17 00:00:00 2001 From: Rodrigo Gomez Palacio Date: Wed, 18 Dec 2024 13:37:15 -0600 Subject: [PATCH 05/11] Missing semicolon --- src/snippets/types.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/snippets/types.ts b/src/snippets/types.ts index 4be47c9..ad94cf8 100644 --- a/src/snippets/types.ts +++ b/src/snippets/types.ts @@ -106,7 +106,7 @@ export const NOTIFICATION_EVENT_TYPE_MAP = `type NotificationEventTypeMap = { 'dismiss': NotificationDismissEvent; 'permissionChange': boolean; 'permissionPromptDisplay': void; -} +}; `; export const NOTIFICATION_DISMISS_EVENT = `interface NotificationDismissEvent { notification: IOSNotification; From 6ae24c16c8659cb659e0f6a106f054b3f6d6a730 Mon Sep 17 00:00:00 2001 From: Rodrigo Gomez Palacio Date: Wed, 18 Dec 2024 13:37:54 -0600 Subject: [PATCH 06/11] Add missing types `UserChangeEvent` & new properties Motivation: these were not added when the api.json was updated --- src/managers/TypingsWriterManager.ts | 6 +++++- src/snippets/types.ts | 7 +++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/src/managers/TypingsWriterManager.ts b/src/managers/TypingsWriterManager.ts index a56729d..11668f5 100644 --- a/src/managers/TypingsWriterManager.ts +++ b/src/managers/TypingsWriterManager.ts @@ -17,7 +17,9 @@ import { SLIDEDOWN_EVENT_NAME, SLIDEDOWN_OPTIONS, SUBSCRIPTION_CHANGE_EVENT, - TAG_CATEGORY } from "../snippets/types"; + TAG_CATEGORY, + USER_CHANGE_EVENT, + USER_NAMESPACE_PROPERTIES} from "../snippets/types"; import { INTERFACE_PREFIX } from "../support/constants"; import { ReaderManager } from "./ReaderManager"; @@ -96,6 +98,8 @@ export class TypingsWriterManager extends CodeWriter { this.writeLine(prefix+NOTIFICATION_FOREGROUND_WILL_DISPLAY_EVENT); this.writeLine(prefix+NOTIFICATION_DISMISS_EVENT); this.writeLine(prefix+NOTIFICATION_CLICK_EVENT); + this.writeLine(prefix+USER_CHANGE_EVENT); + this.writeLine(prefix+USER_NAMESPACE_PROPERTIES); this.writeLine(); this.writeLine(initObjectInterfaceContents); } diff --git a/src/snippets/types.ts b/src/snippets/types.ts index ad94cf8..b881b1d 100644 --- a/src/snippets/types.ts +++ b/src/snippets/types.ts @@ -117,3 +117,10 @@ export const NOTIFICATION_CLICK_EVENT = `interface NotificationClickEvent { readonly result: NotificationClickResult; } `; +export const USER_CHANGE_EVENT = `type UserChangeEvent = { + current: UserNamespaceProperties; +};`; +export const USER_NAMESPACE_PROPERTIES = `type UserNamespaceProperties = { + onesignalId: string | undefined; + externalId: string | undefined; +};`; From a3ac32f81dfd6f5ab2164adf9f7d5e2c3d8cfd9b Mon Sep 17 00:00:00 2001 From: Rodrigo Gomez Palacio Date: Wed, 18 Dec 2024 14:32:51 -0600 Subject: [PATCH 07/11] Update function templates to support non-void return types Motivation: with the introduction of `getTags` we have some methods that actually return a value --- .../angular/oneSignalFunctionTemplates.ts | 51 ++++++++++++++----- .../react/oneSignalFunctionTemplates.ts | 38 ++++++++++---- src/support/utils.ts | 7 +++ src/support/vue/oneSignalFunctionTemplates.ts | 38 ++++++++++---- 4 files changed, 102 insertions(+), 32 deletions(-) diff --git a/src/support/angular/oneSignalFunctionTemplates.ts b/src/support/angular/oneSignalFunctionTemplates.ts index e29521b..2933f8e 100644 --- a/src/support/angular/oneSignalFunctionTemplates.ts +++ b/src/support/angular/oneSignalFunctionTemplates.ts @@ -1,32 +1,59 @@ import { IFunctionSignature } from "../../models/FunctionSignature"; -import { getChainedNamespaceString, spreadArgs, spreadArgsWithTypes } from "../utils"; +import { getChainedNamespaceString, hasNonVoidReturnType, spreadArgs, spreadArgsWithTypes } from "../utils"; -export const ngOneSignalAsyncFunctionTemplate = (sig: IFunctionSignature, uniqueFunctionName: string, namespaceChain: string[]) => { +export const ngOneSignalAsyncFunctionTemplate = ( + sig: IFunctionSignature, + uniqueFunctionName: string, + namespaceChain: string[] +): string => { const args = sig.args?.map(arg => arg.name); const chainedNamespaceString = getChainedNamespaceString(namespaceChain); + return ` -function ${uniqueFunctionName}${sig.genericTypeParameter ?? ''}(${spreadArgsWithTypes(sig)}): ${sig.returnType || 'void'} { +function ${uniqueFunctionName}${sig.genericTypeParameter ?? ''}(${spreadArgsWithTypes(sig)}): ${sig.returnType} { return new Promise((resolve, reject) => { if (isOneSignalScriptFailed) { - reject(); + reject(new Error('OneSignal script failed to load.')); + return; } window.OneSignalDeferred?.push((oneSignal: IOneSignalOneSignal) => { - oneSignal.${chainedNamespaceString}${chainedNamespaceString !== '' ? '.' : ''}${sig.name}(${spreadArgs(args)}) - .then((value: any) => resolve(value)) - .catch((error: Error) => reject(error)); + ${hasNonVoidReturnType(sig) ? 'resolve(' : ''}oneSignal.${chainedNamespaceString}${ + chainedNamespaceString !== '' ? '.' : '' + }${sig.name}(${spreadArgs(args)})${hasNonVoidReturnType(sig) ? ')' : '.then(() => resolve())'}; }); }); -}` +} +`.trim(); }; -export const ngOneSignalFunctionTemplate = (sig: IFunctionSignature, uniqueFunctionName: string, namespaceChain: string[]) => { +export const ngOneSignalFunctionTemplate = ( + sig: IFunctionSignature, + uniqueFunctionName: string, + namespaceChain: string[] +): string => { const args = sig.args?.map(arg => arg.name); const chainedNamespaceString = getChainedNamespaceString(namespaceChain); + + const retValDeclaration = hasNonVoidReturnType(sig) + ? `let retVal: ${sig.returnType};` + : ''; + const retValAssignment = hasNonVoidReturnType(sig) ? 'retVal = ' : ''; + const retValReturn = hasNonVoidReturnType(sig) + ? `// @ts-ignore\n return retVal;` + : ''; + return ` -function ${uniqueFunctionName}${sig.genericTypeParameter ?? ''}(${spreadArgsWithTypes(sig)}): ${sig.returnType || 'void'} { +function ${uniqueFunctionName}${sig.genericTypeParameter ?? ''}(${spreadArgsWithTypes(sig)}): ${ + sig.returnType || 'void' + } { + ${retValDeclaration} window.OneSignalDeferred?.push((oneSignal: IOneSignalOneSignal) => { - oneSignal.${chainedNamespaceString}${chainedNamespaceString !== '' ? '.' : ''}${sig.name}(${spreadArgs(args)}); + ${retValAssignment}oneSignal.${chainedNamespaceString}${ + chainedNamespaceString !== '' ? '.' : '' + }${sig.name}(${spreadArgs(args)}); }); -}` + ${retValReturn} +} +`.replace(/^\s*[\r\n]/gm, ''); // Remove extra newlines }; diff --git a/src/support/react/oneSignalFunctionTemplates.ts b/src/support/react/oneSignalFunctionTemplates.ts index 25fe720..6937fa2 100644 --- a/src/support/react/oneSignalFunctionTemplates.ts +++ b/src/support/react/oneSignalFunctionTemplates.ts @@ -1,36 +1,54 @@ import { IFunctionSignature } from "../../models/FunctionSignature"; -import { getChainedNamespaceString, spreadArgs, spreadArgsWithTypes } from "../utils"; +import { getChainedNamespaceString, hasNonVoidReturnType, spreadArgs, spreadArgsWithTypes } from "../utils"; -export const reactOneSignalAsyncFunctionTemplate = (sig: IFunctionSignature, uniqueFunctionName: string, namespaceChain: string[]) => { +export const reactOneSignalAsyncFunctionTemplate = ( + sig: IFunctionSignature, + uniqueFunctionName: string, + namespaceChain: string[] +): string => { const args = sig.args?.map(arg => arg.name); const chainedNamespaceString = getChainedNamespaceString(namespaceChain); + return ` -function ${uniqueFunctionName}${sig.genericTypeParameter ?? ''}(${spreadArgsWithTypes(sig)}): ${sig.returnType || 'void'} { +function ${uniqueFunctionName}${sig.genericTypeParameter ?? ''}(${spreadArgsWithTypes(sig)}): ${sig.returnType} { return new Promise((resolve, reject) => { if (isOneSignalScriptFailed) { - reject(); + reject(new Error('OneSignal script failed to load.')); + return; } try { window.OneSignalDeferred?.push((OneSignal: IOneSignalOneSignal) => { - OneSignal.${chainedNamespaceString}${chainedNamespaceString !== '' ? '.' : ''}${sig.name}(${spreadArgs(args)}) - .then((value: any) => resolve(value)) + ${hasNonVoidReturnType(sig) ? 'resolve(' : ''}OneSignal.${chainedNamespaceString}${ + chainedNamespaceString !== '' ? '.' : '' + }${sig.name}(${spreadArgs(args)})${hasNonVoidReturnType(sig) ? ')' : '.then(() => resolve())'} .catch((error: any) => reject(error)); }); } catch (error) { reject(error); } }); -}` +} +`.trim(); }; -export const reactOneSignalFunctionTemplate = (sig: IFunctionSignature, uniqueFunctionName: string, namespaceChain: string[]) => { +export const reactOneSignalFunctionTemplate = ( + sig: IFunctionSignature, + uniqueFunctionName: string, + namespaceChain: string[] +): string => { const args = sig.args?.map(arg => arg.name); const chainedNamespaceString = getChainedNamespaceString(namespaceChain); + return ` function ${uniqueFunctionName}${sig.genericTypeParameter ?? ''}(${spreadArgsWithTypes(sig)}): ${sig.returnType || 'void'} { + ${hasNonVoidReturnType(sig) ? `let retVal: ${sig.returnType};` : ''} window.OneSignalDeferred?.push((OneSignal: IOneSignalOneSignal) => { - OneSignal.${chainedNamespaceString}${chainedNamespaceString !== '' ? '.' : ''}${sig.name}(${spreadArgs(args)}) + ${hasNonVoidReturnType(sig) ? 'retVal = ' : ''}OneSignal.${chainedNamespaceString}${ + chainedNamespaceString !== '' ? '.' : '' + }${sig.name}(${spreadArgs(args)}); }); -}` + ${hasNonVoidReturnType(sig) ? 'return retVal;' : ''} +} +`.trim(); }; diff --git a/src/support/utils.ts b/src/support/utils.ts index 6c9f6c7..be61609 100644 --- a/src/support/utils.ts +++ b/src/support/utils.ts @@ -121,3 +121,10 @@ function capitalizeFirstLetter(str: string): string { export function generateUniqueFunctionName(namespaceName: string, functionName: string): string { return `${toCamelCase(namespaceName)}${capitalizeFirstLetter(functionName)}`; } + +export function hasNonVoidReturnType(sig: IFunctionSignature): boolean { + if (sig.isAsync) { + return sig.returnType !== 'Promise'; + } + return sig.returnType !== 'void'; +} diff --git a/src/support/vue/oneSignalFunctionTemplates.ts b/src/support/vue/oneSignalFunctionTemplates.ts index c6dd8ed..83f8f44 100644 --- a/src/support/vue/oneSignalFunctionTemplates.ts +++ b/src/support/vue/oneSignalFunctionTemplates.ts @@ -1,36 +1,54 @@ import { IFunctionSignature } from "../../models/FunctionSignature"; -import { getChainedNamespaceString, spreadArgs, spreadArgsWithTypes } from "../../support/utils"; +import { getChainedNamespaceString, hasNonVoidReturnType, spreadArgs, spreadArgsWithTypes } from "../../support/utils"; -export const vueOneSignalAsyncFunctionTemplate = (sig: IFunctionSignature, uniqueFunctionName: string, namespaceChain: string[]) => { +export const vueOneSignalAsyncFunctionTemplate = ( + sig: IFunctionSignature, + uniqueFunctionName: string, + namespaceChain: string[] +): string => { const args = sig.args?.map(arg => arg.name); const chainedNamespaceString = getChainedNamespaceString(namespaceChain); + return ` -function ${uniqueFunctionName}${sig.genericTypeParameter ?? ''}(${spreadArgsWithTypes(sig)}): ${sig.returnType || 'void'} { +function ${uniqueFunctionName}${sig.genericTypeParameter ?? ''}(${spreadArgsWithTypes(sig)}): ${sig.returnType} { return new Promise(function (resolve, reject) { if (isOneSignalScriptFailed) { - reject(); + reject(new Error('OneSignal script failed to load.')); + return; } try { window.OneSignalDeferred?.push((OneSignal) => { - OneSignal.${chainedNamespaceString}${chainedNamespaceString !== '' ? '.' : ''}${sig.name}(${spreadArgs(args)}) - .then(value => resolve(value)) + ${hasNonVoidReturnType(sig) ? 'resolve(' : ''}OneSignal.${chainedNamespaceString}${ + chainedNamespaceString !== '' ? '.' : '' + }${sig.name}(${spreadArgs(args)})${hasNonVoidReturnType(sig) ? ')' : '.then(() => resolve())'} .catch(error => reject(error)); }); } catch (error) { reject(error); } }); -}` +} +`.trim(); }; -export const vueOneSignalFunctionTemplate = (sig: IFunctionSignature, uniqueFunctionName: string, namespaceChain: string[]) => { +export const vueOneSignalFunctionTemplate = ( + sig: IFunctionSignature, + uniqueFunctionName: string, + namespaceChain: string[] +): string => { const args = sig.args?.map(arg => arg.name); const chainedNamespaceString = getChainedNamespaceString(namespaceChain); + return ` function ${uniqueFunctionName}${sig.genericTypeParameter ?? ''}(${spreadArgsWithTypes(sig)}): ${sig.returnType || 'void'} { + ${hasNonVoidReturnType(sig) ? `let retVal: ${sig.returnType};` : ''} window.OneSignalDeferred?.push((OneSignal) => { - OneSignal.${chainedNamespaceString}${chainedNamespaceString !== '' ? '.' : ''}${sig.name}(${spreadArgs(args)}) + ${hasNonVoidReturnType(sig) ? 'retVal = ' : ''}OneSignal.${chainedNamespaceString}${ + chainedNamespaceString !== '' ? '.' : '' + }${sig.name}(${spreadArgs(args)}); }); -}` + ${hasNonVoidReturnType(sig) ? 'return retVal;' : ''} +} +`.trim(); }; From 7a6146cb9c645ae216410d9c8ce50adc619cde83 Mon Sep 17 00:00:00 2001 From: Rodrigo Gomez Palacio Date: Wed, 18 Dec 2024 14:33:32 -0600 Subject: [PATCH 08/11] Nit: fix semi-colon issue --- src/managers/bases/OneSignalWriterManagerBase.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/managers/bases/OneSignalWriterManagerBase.ts b/src/managers/bases/OneSignalWriterManagerBase.ts index e12bf65..9beca08 100644 --- a/src/managers/bases/OneSignalWriterManagerBase.ts +++ b/src/managers/bases/OneSignalWriterManagerBase.ts @@ -30,8 +30,8 @@ const PARENT_PATH_FOR_NAMESPACE_MAP: { [key: string]: string } = { }; const PROPERTY_DEFAULT_MAP: { [key: string]: string } = { - permissionNative: ` ?? 'default';`, - permission: ` ?? false;` + permissionNative: ` ?? 'default'`, + permission: ` ?? false` }; export abstract class OneSignalWriterManagerBase extends CodeWriter { @@ -86,7 +86,7 @@ export abstract class OneSignalWriterManagerBase extends CodeWriter { if (properties) { properties.forEach(prop => { const defaultValue = PROPERTY_DEFAULT_MAP[prop.name] ?? ''; - this.writeLine(`\tget ${prop.name}(): ${prop.type} { return window.OneSignal?.${PARENT_PATH_FOR_NAMESPACE_MAP[namespaceName] ?? ''}${namespaceName}?.${prop.name}${defaultValue} },`); + this.writeLine(`\tget ${prop.name}(): ${prop.type} { return window.OneSignal?.${PARENT_PATH_FOR_NAMESPACE_MAP[namespaceName] ?? ''}${namespaceName}?.${prop.name}${defaultValue}; },`); }); } From 4e3691e92abd5158fe863fea2c807fcd7db8c3c5 Mon Sep 17 00:00:00 2001 From: Rodrigo Gomez Palacio Date: Wed, 18 Dec 2024 14:33:45 -0600 Subject: [PATCH 09/11] Commit NGX service file --- .../src/lib/onesignal-ngx.service.ts | 178 +++++++++--------- 1 file changed, 92 insertions(+), 86 deletions(-) diff --git a/src/scaffolds/angular-workspace/projects/onesignal-ngx/src/lib/onesignal-ngx.service.ts b/src/scaffolds/angular-workspace/projects/onesignal-ngx/src/lib/onesignal-ngx.service.ts index 318e398..4d7b643 100644 --- a/src/scaffolds/angular-workspace/projects/onesignal-ngx/src/lib/onesignal-ngx.service.ts +++ b/src/scaffolds/angular-workspace/projects/onesignal-ngx/src/lib/onesignal-ngx.service.ts @@ -49,7 +49,7 @@ interface IOSNotification { * If this value is the same as existing notification, it will replace it * Can be set when creating the notification with "Web Push Topic" on the dashboard * or web_push_topic from the REST API. - */ + */ readonly topic?: string; /** @@ -101,7 +101,7 @@ type NotificationEventTypeMap = { 'dismiss': NotificationDismissEvent; 'permissionChange': boolean; 'permissionPromptDisplay': void; -} +}; interface NotificationForegroundWillDisplayEvent { readonly notification: IOSNotification; @@ -117,6 +117,13 @@ interface NotificationClickEvent { readonly result: NotificationClickResult; } +type UserChangeEvent = { + current: UserNamespaceProperties; +}; +type UserNamespaceProperties = { + onesignalId: string | undefined; + externalId: string | undefined; +}; interface IInitObject { appId: string; @@ -178,6 +185,8 @@ interface IOneSignalSession { sendUniqueOutcome(outcomeName: string): Promise; } interface IOneSignalUser { + onesignalId: string | undefined; + externalId: string | undefined; PushSubscription: IOneSignalPushSubscription; addAlias(label: string, id: string): void; addAliases(aliases: { [key: string]: string }): void; @@ -191,6 +200,9 @@ interface IOneSignalUser { addTags(tags: { [key: string]: string }): void; removeTag(key: string): void; removeTags(keys: string[]): void; + getTags(): { [key: string]: string }; + addEventListener(event: 'change', listener: (change: UserChangeEvent) => void): void; + removeEventListener(event: 'change', listener: (change: UserChangeEvent) => void): void; } interface IOneSignalPushSubscription { id: string | null | undefined; @@ -201,133 +213,114 @@ interface IOneSignalPushSubscription { addEventListener(event: 'change', listener: (change: SubscriptionChangeEvent) => void): void; removeEventListener(event: 'change', listener: (change: SubscriptionChangeEvent) => void): void; } - function oneSignalLogin(externalId: string, jwtToken?: string): Promise { return new Promise((resolve, reject) => { if (isOneSignalScriptFailed) { - reject(); + reject(new Error('OneSignal script failed to load.')); + return; } window.OneSignalDeferred?.push((oneSignal: IOneSignalOneSignal) => { - oneSignal.login(externalId, jwtToken) - .then((value: any) => resolve(value)) - .catch((error: Error) => reject(error)); + oneSignal.login(externalId, jwtToken).then(() => resolve()); }); }); } - function oneSignalLogout(): Promise { return new Promise((resolve, reject) => { if (isOneSignalScriptFailed) { - reject(); + reject(new Error('OneSignal script failed to load.')); + return; } window.OneSignalDeferred?.push((oneSignal: IOneSignalOneSignal) => { - oneSignal.logout() - .then((value: any) => resolve(value)) - .catch((error: Error) => reject(error)); + oneSignal.logout().then(() => resolve()); }); }); } - function oneSignalSetConsentGiven(consent: boolean): Promise { return new Promise((resolve, reject) => { if (isOneSignalScriptFailed) { - reject(); + reject(new Error('OneSignal script failed to load.')); + return; } window.OneSignalDeferred?.push((oneSignal: IOneSignalOneSignal) => { - oneSignal.setConsentGiven(consent) - .then((value: any) => resolve(value)) - .catch((error: Error) => reject(error)); + oneSignal.setConsentGiven(consent).then(() => resolve()); }); }); } - function oneSignalSetConsentRequired(requiresConsent: boolean): Promise { return new Promise((resolve, reject) => { if (isOneSignalScriptFailed) { - reject(); + reject(new Error('OneSignal script failed to load.')); + return; } window.OneSignalDeferred?.push((oneSignal: IOneSignalOneSignal) => { - oneSignal.setConsentRequired(requiresConsent) - .then((value: any) => resolve(value)) - .catch((error: Error) => reject(error)); + oneSignal.setConsentRequired(requiresConsent).then(() => resolve()); }); }); } - function slidedownPromptPush(options?: AutoPromptOptions): Promise { return new Promise((resolve, reject) => { if (isOneSignalScriptFailed) { - reject(); + reject(new Error('OneSignal script failed to load.')); + return; } window.OneSignalDeferred?.push((oneSignal: IOneSignalOneSignal) => { - oneSignal.Slidedown.promptPush(options) - .then((value: any) => resolve(value)) - .catch((error: Error) => reject(error)); + oneSignal.Slidedown.promptPush(options).then(() => resolve()); }); }); } - function slidedownPromptPushCategories(options?: AutoPromptOptions): Promise { return new Promise((resolve, reject) => { if (isOneSignalScriptFailed) { - reject(); + reject(new Error('OneSignal script failed to load.')); + return; } window.OneSignalDeferred?.push((oneSignal: IOneSignalOneSignal) => { - oneSignal.Slidedown.promptPushCategories(options) - .then((value: any) => resolve(value)) - .catch((error: Error) => reject(error)); + oneSignal.Slidedown.promptPushCategories(options).then(() => resolve()); }); }); } - function slidedownPromptSms(options?: AutoPromptOptions): Promise { return new Promise((resolve, reject) => { if (isOneSignalScriptFailed) { - reject(); + reject(new Error('OneSignal script failed to load.')); + return; } window.OneSignalDeferred?.push((oneSignal: IOneSignalOneSignal) => { - oneSignal.Slidedown.promptSms(options) - .then((value: any) => resolve(value)) - .catch((error: Error) => reject(error)); + oneSignal.Slidedown.promptSms(options).then(() => resolve()); }); }); } - function slidedownPromptEmail(options?: AutoPromptOptions): Promise { return new Promise((resolve, reject) => { if (isOneSignalScriptFailed) { - reject(); + reject(new Error('OneSignal script failed to load.')); + return; } window.OneSignalDeferred?.push((oneSignal: IOneSignalOneSignal) => { - oneSignal.Slidedown.promptEmail(options) - .then((value: any) => resolve(value)) - .catch((error: Error) => reject(error)); + oneSignal.Slidedown.promptEmail(options).then(() => resolve()); }); }); } - function slidedownPromptSmsAndEmail(options?: AutoPromptOptions): Promise { return new Promise((resolve, reject) => { if (isOneSignalScriptFailed) { - reject(); + reject(new Error('OneSignal script failed to load.')); + return; } window.OneSignalDeferred?.push((oneSignal: IOneSignalOneSignal) => { - oneSignal.Slidedown.promptSmsAndEmail(options) - .then((value: any) => resolve(value)) - .catch((error: Error) => reject(error)); + oneSignal.Slidedown.promptSmsAndEmail(options).then(() => resolve()); }); }); } - function slidedownAddEventListener(event: SlidedownEventName, listener: (wasShown: boolean) => void): void { window.OneSignalDeferred?.push((oneSignal: IOneSignalOneSignal) => { oneSignal.Slidedown.addEventListener(event, listener); @@ -343,45 +336,39 @@ function slidedownRemoveEventListener(event: SlidedownEventName, listener: (wasS function notificationsSetDefaultUrl(url: string): Promise { return new Promise((resolve, reject) => { if (isOneSignalScriptFailed) { - reject(); + reject(new Error('OneSignal script failed to load.')); + return; } window.OneSignalDeferred?.push((oneSignal: IOneSignalOneSignal) => { - oneSignal.Notifications.setDefaultUrl(url) - .then((value: any) => resolve(value)) - .catch((error: Error) => reject(error)); + oneSignal.Notifications.setDefaultUrl(url).then(() => resolve()); }); }); } - function notificationsSetDefaultTitle(title: string): Promise { return new Promise((resolve, reject) => { if (isOneSignalScriptFailed) { - reject(); + reject(new Error('OneSignal script failed to load.')); + return; } window.OneSignalDeferred?.push((oneSignal: IOneSignalOneSignal) => { - oneSignal.Notifications.setDefaultTitle(title) - .then((value: any) => resolve(value)) - .catch((error: Error) => reject(error)); + oneSignal.Notifications.setDefaultTitle(title).then(() => resolve()); }); }); } - function notificationsRequestPermission(): Promise { return new Promise((resolve, reject) => { if (isOneSignalScriptFailed) { - reject(); + reject(new Error('OneSignal script failed to load.')); + return; } window.OneSignalDeferred?.push((oneSignal: IOneSignalOneSignal) => { - oneSignal.Notifications.requestPermission() - .then((value: any) => resolve(value)) - .catch((error: Error) => reject(error)); + oneSignal.Notifications.requestPermission().then(() => resolve()); }); }); } - function notificationsAddEventListener(event: K, listener: (obj: NotificationEventTypeMap[K]) => void): void { window.OneSignalDeferred?.push((oneSignal: IOneSignalOneSignal) => { oneSignal.Notifications.addEventListener(event, listener); @@ -397,31 +384,27 @@ function notificationsRemoveEventListener(event function sessionSendOutcome(outcomeName: string, outcomeWeight?: number): Promise { return new Promise((resolve, reject) => { if (isOneSignalScriptFailed) { - reject(); + reject(new Error('OneSignal script failed to load.')); + return; } window.OneSignalDeferred?.push((oneSignal: IOneSignalOneSignal) => { - oneSignal.Session.sendOutcome(outcomeName, outcomeWeight) - .then((value: any) => resolve(value)) - .catch((error: Error) => reject(error)); + oneSignal.Session.sendOutcome(outcomeName, outcomeWeight).then(() => resolve()); }); }); } - function sessionSendUniqueOutcome(outcomeName: string): Promise { return new Promise((resolve, reject) => { if (isOneSignalScriptFailed) { - reject(); + reject(new Error('OneSignal script failed to load.')); + return; } window.OneSignalDeferred?.push((oneSignal: IOneSignalOneSignal) => { - oneSignal.Session.sendUniqueOutcome(outcomeName) - .then((value: any) => resolve(value)) - .catch((error: Error) => reject(error)); + oneSignal.Session.sendUniqueOutcome(outcomeName).then(() => resolve()); }); }); } - function userAddAlias(label: string, id: string): void { window.OneSignalDeferred?.push((oneSignal: IOneSignalOneSignal) => { oneSignal.User.addAlias(label, id); @@ -494,34 +477,51 @@ function userRemoveTags(keys: string[]): void { }); } +function userGetTags(): { [key: string]: string } { + let retVal: { [key: string]: string }; + window.OneSignalDeferred?.push((oneSignal: IOneSignalOneSignal) => { + retVal = oneSignal.User.getTags(); + }); + // @ts-ignore + return retVal; +} + +function userAddEventListener(event: 'change', listener: (change: UserChangeEvent) => void): void { + window.OneSignalDeferred?.push((oneSignal: IOneSignalOneSignal) => { + oneSignal.User.addEventListener(event, listener); + }); +} + +function userRemoveEventListener(event: 'change', listener: (change: UserChangeEvent) => void): void { + window.OneSignalDeferred?.push((oneSignal: IOneSignalOneSignal) => { + oneSignal.User.removeEventListener(event, listener); + }); +} + function pushSubscriptionOptIn(): Promise { return new Promise((resolve, reject) => { if (isOneSignalScriptFailed) { - reject(); + reject(new Error('OneSignal script failed to load.')); + return; } window.OneSignalDeferred?.push((oneSignal: IOneSignalOneSignal) => { - oneSignal.User.PushSubscription.optIn() - .then((value: any) => resolve(value)) - .catch((error: Error) => reject(error)); + oneSignal.User.PushSubscription.optIn().then(() => resolve()); }); }); } - function pushSubscriptionOptOut(): Promise { return new Promise((resolve, reject) => { if (isOneSignalScriptFailed) { - reject(); + reject(new Error('OneSignal script failed to load.')); + return; } window.OneSignalDeferred?.push((oneSignal: IOneSignalOneSignal) => { - oneSignal.User.PushSubscription.optOut() - .then((value: any) => resolve(value)) - .catch((error: Error) => reject(error)); + oneSignal.User.PushSubscription.optOut().then(() => resolve()); }); }); } - function pushSubscriptionAddEventListener(event: 'change', listener: (change: SubscriptionChangeEvent) => void): void { window.OneSignalDeferred?.push((oneSignal: IOneSignalOneSignal) => { oneSignal.User.PushSubscription.addEventListener(event, listener); @@ -540,10 +540,11 @@ function debugSetLogLevel(logLevel: string): void { }); } + const PushSubscriptionNamespace: IOneSignalPushSubscription = { - get id(): string | null | undefined { return window.OneSignal?.User?.PushSubscription?.id }, - get token(): string | null | undefined { return window.OneSignal?.User?.PushSubscription?.token }, - get optedIn(): boolean | undefined { return window.OneSignal?.User?.PushSubscription?.optedIn }, + get id(): string | null | undefined { return window.OneSignal?.User?.PushSubscription?.id; }, + get token(): string | null | undefined { return window.OneSignal?.User?.PushSubscription?.token; }, + get optedIn(): boolean | undefined { return window.OneSignal?.User?.PushSubscription?.optedIn; }, optIn: pushSubscriptionOptIn, optOut: pushSubscriptionOptOut, addEventListener: pushSubscriptionAddEventListener, @@ -551,6 +552,8 @@ const PushSubscriptionNamespace: IOneSignalPushSubscription = { }; const UserNamespace: IOneSignalUser = { + get onesignalId(): string | undefined { return window.OneSignal?.User?.onesignalId; }, + get externalId(): string | undefined { return window.OneSignal?.User?.externalId; }, addAlias: userAddAlias, addAliases: userAddAliases, removeAlias: userRemoveAlias, @@ -563,6 +566,9 @@ const UserNamespace: IOneSignalUser = { addTags: userAddTags, removeTag: userRemoveTag, removeTags: userRemoveTags, + getTags: userGetTags, + addEventListener: userAddEventListener, + removeEventListener: userRemoveEventListener, PushSubscription: PushSubscriptionNamespace, }; From a66636399f0dbbf878eb9de53941c09a203e9f2d Mon Sep 17 00:00:00 2001 From: Rodrigo Gomez Palacio Date: Wed, 18 Dec 2024 14:34:07 -0600 Subject: [PATCH 10/11] Commit lock file --- yarn.lock | 164 ++++++++++++++++++++++++++++++------------------------ 1 file changed, 92 insertions(+), 72 deletions(-) diff --git a/yarn.lock b/yarn.lock index 2f01131..956e370 100644 --- a/yarn.lock +++ b/yarn.lock @@ -9,19 +9,19 @@ dependencies: eslint-visitor-keys "^3.3.0" -"@eslint-community/regexpp@^4.4.0": - version "4.4.0" - resolved "https://registry.yarnpkg.com/@eslint-community/regexpp/-/regexpp-4.4.0.tgz#3e61c564fcd6b921cb789838631c5ee44df09403" - integrity sha512-A9983Q0LnDGdLPjxyXQ00sbV+K+O+ko2Dr+CZigbHWtX9pNfxlaBkMR8X1CztI73zuEyEBXTVjx7CE+/VSwDiQ== +"@eslint-community/regexpp@^4.6.1": + version "4.12.1" + resolved "https://registry.yarnpkg.com/@eslint-community/regexpp/-/regexpp-4.12.1.tgz#cfc6cffe39df390a3841cde2abccf92eaa7ae0e0" + integrity sha512-CCZCDJuduB9OUkFkY2IgppNZMi2lBQgD2qzwXkEia16cge2pijY/aXi96CJMquDMn3nJdlPV1A5KrJEXwfLNzQ== -"@eslint/eslintrc@^2.0.1": - version "2.0.1" - resolved "https://registry.yarnpkg.com/@eslint/eslintrc/-/eslintrc-2.0.1.tgz#7888fe7ec8f21bc26d646dbd2c11cd776e21192d" - integrity sha512-eFRmABvW2E5Ho6f5fHLqgena46rOj7r7OKHYfLElqcBfGFHHpjBhivyi5+jOEQuSpdc/1phIZJlbC2te+tZNIw== +"@eslint/eslintrc@^2.1.4": + version "2.1.4" + resolved "https://registry.yarnpkg.com/@eslint/eslintrc/-/eslintrc-2.1.4.tgz#388a269f0f25c1b6adc317b5a2c55714894c70ad" + integrity sha512-269Z39MS6wVJtsoUl10L60WdkhJVdPG24Q4eZTH3nnF6lpvSShEK3wQjDX9JRWAUPvPh7COouPpU9IrqaZFvtQ== dependencies: ajv "^6.12.4" debug "^4.3.2" - espree "^9.5.0" + espree "^9.6.0" globals "^13.19.0" ignore "^5.2.0" import-fresh "^3.2.1" @@ -29,18 +29,18 @@ minimatch "^3.1.2" strip-json-comments "^3.1.1" -"@eslint/js@8.36.0": - version "8.36.0" - resolved "https://registry.yarnpkg.com/@eslint/js/-/js-8.36.0.tgz#9837f768c03a1e4a30bd304a64fb8844f0e72efe" - integrity sha512-lxJ9R5ygVm8ZWgYdUweoq5ownDlJ4upvoWmO4eLxBYHdMo+vZ/Rx0EN6MbKWDJOSUGrqJy2Gt+Dyv/VKml0fjg== +"@eslint/js@8.57.1": + version "8.57.1" + resolved "https://registry.yarnpkg.com/@eslint/js/-/js-8.57.1.tgz#de633db3ec2ef6a3c89e2f19038063e8a122e2c2" + integrity sha512-d9zaMRSTIKDLhctzH12MtXvJKSSUhaHcjV+2Z+GK+EEY7XKpP5yR4x+N3TAcHTcu963nIr+TMcCb4DBCYX1z6Q== -"@humanwhocodes/config-array@^0.11.8": - version "0.11.8" - resolved "https://registry.yarnpkg.com/@humanwhocodes/config-array/-/config-array-0.11.8.tgz#03595ac2075a4dc0f191cc2131de14fbd7d410b9" - integrity sha512-UybHIJzJnR5Qc/MsD9Kr+RpO2h+/P1GhOwdiLPXK5TWk5sgTdu88bTD9UP+CKbPPh5Rni1u0GjAdYQLemG8g+g== +"@humanwhocodes/config-array@^0.13.0": + version "0.13.0" + resolved "https://registry.yarnpkg.com/@humanwhocodes/config-array/-/config-array-0.13.0.tgz#fb907624df3256d04b9aa2df50d7aa97ec648748" + integrity sha512-DZLEEqFWQFiyK6h5YIeynKx7JlvCYWL0cImfSRXZ9l4Sg2efkFGTuFf6vzXjK1cq6IYkU+Eg/JizXw+TD2vRNw== dependencies: - "@humanwhocodes/object-schema" "^1.2.1" - debug "^4.1.1" + "@humanwhocodes/object-schema" "^2.0.3" + debug "^4.3.1" minimatch "^3.0.5" "@humanwhocodes/module-importer@^1.0.1": @@ -48,10 +48,10 @@ resolved "https://registry.yarnpkg.com/@humanwhocodes/module-importer/-/module-importer-1.0.1.tgz#af5b2691a22b44be847b0ca81641c5fb6ad0172c" integrity sha512-bxveV4V8v5Yb4ncFTT3rPSgZBOpCkjfK0y4oVVVJwIuDVBRMDXrPyXRL988i5ap9m9bnyEEjWfm5WkBmtffLfA== -"@humanwhocodes/object-schema@^1.2.1": - version "1.2.1" - resolved "https://registry.yarnpkg.com/@humanwhocodes/object-schema/-/object-schema-1.2.1.tgz#b520529ec21d8e5945a1851dfd1c32e94e39ff45" - integrity sha512-ZnQMnLV4e7hDlUvw8H+U8ASL02SS2Gn6+9Ac3wGGLIe7+je2AeAOxPY+izIPJDfFDb7eDjev0Us8MO1iFRN8hA== +"@humanwhocodes/object-schema@^2.0.3": + version "2.0.3" + resolved "https://registry.yarnpkg.com/@humanwhocodes/object-schema/-/object-schema-2.0.3.tgz#4a2868d75d6d6963e423bcf90b7fd1be343409d3" + integrity sha512-93zYdMES/c1D69yZiKDBj0V24vqNzB/koF26KPaagAfd3P/4gUlh3Dys5ogAK+Exi9QyzlD8x/08Zt7wIKcDcA== "@nodelib/fs.scandir@2.1.5": version "2.1.5" @@ -173,6 +173,11 @@ "@typescript-eslint/types" "5.54.1" eslint-visitor-keys "^3.3.0" +"@ungap/structured-clone@^1.2.0": + version "1.2.1" + resolved "https://registry.yarnpkg.com/@ungap/structured-clone/-/structured-clone-1.2.1.tgz#28fa185f67daaf7b7a1a8c1d445132c5d979f8bd" + integrity sha512-fEzPV3hSkSMltkw152tJKNARhOupqbH96MZWyRjNaYZOMIzbrTeQDG+MTc6Mr2pgzFQzFxAfmhGDNP5QK++2ZA== + "@yellicode/core@^1.3.0", "@yellicode/core@^1.5.0": version "1.5.0" resolved "https://registry.yarnpkg.com/@yellicode/core/-/core-1.5.0.tgz#2a3d7e28b06a92c20268b52ded45a08e8718e2a1" @@ -201,12 +206,12 @@ acorn-jsx@^5.3.2: resolved "https://registry.yarnpkg.com/acorn-jsx/-/acorn-jsx-5.3.2.tgz#7ed5bb55908b3b2f1bc55c6af1653bada7f07937" integrity sha512-rq9s+JNhf0IChjtDXxllJ7g41oZk5SlXtp0LHwyA5cejwn7vKmKp4pPri6YEePv2PU65sAsegbXtIinmDFDXgQ== -acorn@^8.8.0: - version "8.8.2" - resolved "https://registry.yarnpkg.com/acorn/-/acorn-8.8.2.tgz#1b2f25db02af965399b9776b0c2c391276d37c4a" - integrity sha512-xjIYgE8HBrkpd/sJqOGNspf8uHG+NOHGOw6a/Urj8taM2EXfdNAH2oFcPeIFfsv3+kz/mJrS5VuMqbNLjCa2vw== +acorn@^8.9.0: + version "8.14.0" + resolved "https://registry.yarnpkg.com/acorn/-/acorn-8.14.0.tgz#063e2c70cac5fb4f6467f0b11152e04c682795b0" + integrity sha512-cl669nCJTZBsL97OF4kUQm5g5hC2uihk0NxY3WENAC0TYdILVkAyHymAntgxGkl7K+t0cXIrH5siy5S4XkFycA== -ajv@^6.10.0, ajv@^6.12.4: +ajv@^6.12.4: version "6.12.6" resolved "https://registry.yarnpkg.com/ajv/-/ajv-6.12.6.tgz#baf5a62e802b07d977034586f8c3baf5adf26df4" integrity sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g== @@ -302,7 +307,14 @@ curlrequest@^1.0.1: resolved "https://registry.yarnpkg.com/curlrequest/-/curlrequest-1.0.1.tgz#cd3d8e04e81d7996b0a1cd9716cb09d50b41d50f" integrity sha512-SUWXgCtSqkFOBUfyDZ2M6xZmYIxy+9PSO5hGD/TsOnyToXe6/uDFZMOzEY1SlGfMWbK7/pyheJ2UbiLQ/BUAsQ== -debug@^4.1.1, debug@^4.3.2, debug@^4.3.4: +debug@^4.3.1: + version "4.4.0" + resolved "https://registry.yarnpkg.com/debug/-/debug-4.4.0.tgz#2b3f2aea2ffeb776477460267377dc8710faba8a" + integrity sha512-6WTZ/IxCY/T6BALoZHaE4ctp9xm+Z5kY/pzYaCHRFeyVhojxlrm+46y68HA6hr0TcwEssoxNiDEUJQjfPZ/RYA== + dependencies: + ms "^2.1.3" + +debug@^4.3.2, debug@^4.3.4: version "4.3.4" resolved "https://registry.yarnpkg.com/debug/-/debug-4.3.4.tgz#1319f6579357f2338d3337d2cdd4914bb5dcc865" integrity sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ== @@ -341,10 +353,10 @@ eslint-scope@^5.1.1: esrecurse "^4.3.0" estraverse "^4.1.1" -eslint-scope@^7.1.1: - version "7.1.1" - resolved "https://registry.yarnpkg.com/eslint-scope/-/eslint-scope-7.1.1.tgz#fff34894c2f65e5226d3041ac480b4513a163642" - integrity sha512-QKQM/UXpIiHcLqJ5AOyIW7XZmzjkzQXYE54n1++wb0u9V/abW3l9uQnxX8Z5Xd18xyKIMTUAyQ0k1e8pz6LUrw== +eslint-scope@^7.2.2: + version "7.2.2" + resolved "https://registry.yarnpkg.com/eslint-scope/-/eslint-scope-7.2.2.tgz#deb4f92563390f32006894af62a22dba1c46423f" + integrity sha512-dOt21O7lTMhDM+X9mB4GX+DZrZtCUJPL/wlcTqxyrx5IvO0IYtILdtrQGQp+8n5S0gwSVmOf9NQrjMOgfQZlIg== dependencies: esrecurse "^4.3.0" estraverse "^5.2.0" @@ -366,27 +378,33 @@ eslint-visitor-keys@^3.3.0: resolved "https://registry.yarnpkg.com/eslint-visitor-keys/-/eslint-visitor-keys-3.3.0.tgz#f6480fa6b1f30efe2d1968aa8ac745b862469826" integrity sha512-mQ+suqKJVyeuwGYHAdjMFqjCyfl8+Ldnxuyp3ldiMBFKkvytrXUZWaiPCEav8qDHKty44bD+qV1IP4T+w+xXRA== -eslint@^8.36.0: - version "8.36.0" - resolved "https://registry.yarnpkg.com/eslint/-/eslint-8.36.0.tgz#1bd72202200a5492f91803b113fb8a83b11285cf" - integrity sha512-Y956lmS7vDqomxlaaQAHVmeb4tNMp2FWIvU/RnU5BD3IKMD/MJPr76xdyr68P8tV1iNMvN2mRK0yy3c+UjL+bw== +eslint-visitor-keys@^3.4.1, eslint-visitor-keys@^3.4.3: + version "3.4.3" + resolved "https://registry.yarnpkg.com/eslint-visitor-keys/-/eslint-visitor-keys-3.4.3.tgz#0cd72fe8550e3c2eae156a96a4dddcd1c8ac5800" + integrity sha512-wpc+LXeiyiisxPlEkUzU6svyS1frIO3Mgxj1fdy7Pm8Ygzguax2N3Fa/D/ag1WqbOprdI+uY6wMUl8/a2G+iag== + +eslint@^8.46.0: + version "8.57.1" + resolved "https://registry.yarnpkg.com/eslint/-/eslint-8.57.1.tgz#7df109654aba7e3bbe5c8eae533c5e461d3c6ca9" + integrity sha512-ypowyDxpVSYpkXr9WPv2PAZCtNip1Mv5KTW0SCurXv/9iOpcrH9PaqUElksqEB6pChqHGDRCFTyrZlGhnLNGiA== dependencies: "@eslint-community/eslint-utils" "^4.2.0" - "@eslint-community/regexpp" "^4.4.0" - "@eslint/eslintrc" "^2.0.1" - "@eslint/js" "8.36.0" - "@humanwhocodes/config-array" "^0.11.8" + "@eslint-community/regexpp" "^4.6.1" + "@eslint/eslintrc" "^2.1.4" + "@eslint/js" "8.57.1" + "@humanwhocodes/config-array" "^0.13.0" "@humanwhocodes/module-importer" "^1.0.1" "@nodelib/fs.walk" "^1.2.8" - ajv "^6.10.0" + "@ungap/structured-clone" "^1.2.0" + ajv "^6.12.4" chalk "^4.0.0" cross-spawn "^7.0.2" debug "^4.3.2" doctrine "^3.0.0" escape-string-regexp "^4.0.0" - eslint-scope "^7.1.1" - eslint-visitor-keys "^3.3.0" - espree "^9.5.0" + eslint-scope "^7.2.2" + eslint-visitor-keys "^3.4.3" + espree "^9.6.1" esquery "^1.4.2" esutils "^2.0.2" fast-deep-equal "^3.1.3" @@ -394,32 +412,29 @@ eslint@^8.36.0: find-up "^5.0.0" glob-parent "^6.0.2" globals "^13.19.0" - grapheme-splitter "^1.0.4" + graphemer "^1.4.0" ignore "^5.2.0" - import-fresh "^3.0.0" imurmurhash "^0.1.4" is-glob "^4.0.0" is-path-inside "^3.0.3" - js-sdsl "^4.1.4" js-yaml "^4.1.0" json-stable-stringify-without-jsonify "^1.0.1" levn "^0.4.1" lodash.merge "^4.6.2" minimatch "^3.1.2" natural-compare "^1.4.0" - optionator "^0.9.1" + optionator "^0.9.3" strip-ansi "^6.0.1" - strip-json-comments "^3.1.0" text-table "^0.2.0" -espree@^9.5.0: - version "9.5.0" - resolved "https://registry.yarnpkg.com/espree/-/espree-9.5.0.tgz#3646d4e3f58907464edba852fa047e6a27bdf113" - integrity sha512-JPbJGhKc47++oo4JkEoTe2wjy4fmMwvFpgJT9cQzmfXKp22Dr6Hf1tdCteLz1h0P3t+mGvWZ+4Uankvh8+c6zw== +espree@^9.6.0, espree@^9.6.1: + version "9.6.1" + resolved "https://registry.yarnpkg.com/espree/-/espree-9.6.1.tgz#a2a17b8e434690a5432f2f8018ce71d331a48c6f" + integrity sha512-oruZaFkjorTpF32kDSI5/75ViwGeZginGGy2NoOSg3Q9bnwlnmDm4HLnkl0RE3n+njDXR037aY1+x58Z/zFdwQ== dependencies: - acorn "^8.8.0" + acorn "^8.9.0" acorn-jsx "^5.3.2" - eslint-visitor-keys "^3.3.0" + eslint-visitor-keys "^3.4.1" esquery@^1.4.2: version "1.5.0" @@ -573,6 +588,11 @@ grapheme-splitter@^1.0.4: resolved "https://registry.yarnpkg.com/grapheme-splitter/-/grapheme-splitter-1.0.4.tgz#9cf3a665c6247479896834af35cf1dbb4400767e" integrity sha512-bzh50DW9kTPM00T8y4o8vQg89Di9oLJVLW/KaOGIXJWP/iqCN6WKYkbNOF04vFLJhwcpYUh9ydh/+5vpOqV4YQ== +graphemer@^1.4.0: + version "1.4.0" + resolved "https://registry.yarnpkg.com/graphemer/-/graphemer-1.4.0.tgz#fb2f1d55e0e3a1849aeffc90c4fa0dd53a0e66c6" + integrity sha512-EtKwoO6kxCL9WO5xipiHTZlSzBm7WLT627TqC/uVRd0HKmq8NXyebnNYxDoBi7wt8eTWrUrKXCOVaFq9x1kgag== + has-flag@^4.0.0: version "4.0.0" resolved "https://registry.yarnpkg.com/has-flag/-/has-flag-4.0.0.tgz#944771fd9c81c81265c4d6941860da06bb59479b" @@ -583,7 +603,7 @@ ignore@^5.2.0: resolved "https://registry.yarnpkg.com/ignore/-/ignore-5.2.4.tgz#a291c0c6178ff1b960befe47fcdec301674a6324" integrity sha512-MAb38BcSbH0eHNBxn7ql2NH/kX33OkB3lZ1BNdh7ENeRChHTYsTvWrMubiIAMNS2llXEEgZ1MUOBtXChP3kaFQ== -import-fresh@^3.0.0, import-fresh@^3.2.1: +import-fresh@^3.2.1: version "3.3.0" resolved "https://registry.yarnpkg.com/import-fresh/-/import-fresh-3.3.0.tgz#37162c25fcb9ebaa2e6e53d5b4d88ce17d9e0c2b" integrity sha512-veYYhQa+D1QBKznvhUHxb8faxlrwUnxseDAbAp457E0wLNio2bOSKnjYDhMj+YiAq61xrMGhQk9iXVk5FzgQMw== @@ -636,11 +656,6 @@ isexe@^2.0.0: resolved "https://registry.yarnpkg.com/isexe/-/isexe-2.0.0.tgz#e8fbf374dc556ff8947a10dcb0572d633f2cfa10" integrity sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw== -js-sdsl@^4.1.4: - version "4.3.0" - resolved "https://registry.yarnpkg.com/js-sdsl/-/js-sdsl-4.3.0.tgz#aeefe32a451f7af88425b11fdb5f58c90ae1d711" - integrity sha512-mifzlm2+5nZ+lEcLJMoBK0/IH/bDg8XnJfd/Wq6IP+xoCjLZsTOnV2QpxlVbX9bMnkl5PdEjNtBJ9Cj1NjifhQ== - js-yaml@^4.1.0: version "4.1.0" resolved "https://registry.yarnpkg.com/js-yaml/-/js-yaml-4.1.0.tgz#c1fb65f8f5017901cdd2c951864ba18458a10602" @@ -710,6 +725,11 @@ ms@2.1.2: resolved "https://registry.yarnpkg.com/ms/-/ms-2.1.2.tgz#d09d1f357b443f493382a8eb3ccd183872ae6009" integrity sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w== +ms@^2.1.3: + version "2.1.3" + resolved "https://registry.yarnpkg.com/ms/-/ms-2.1.3.tgz#574c8138ce1d2b5861f0b44579dbadd60c6615b2" + integrity sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA== + nanoid@^3.1.12: version "3.3.4" resolved "https://registry.yarnpkg.com/nanoid/-/nanoid-3.3.4.tgz#730b67e3cd09e2deacf03c027c81c9d9dbc5e8ab" @@ -732,17 +752,17 @@ once@^1.3.0: dependencies: wrappy "1" -optionator@^0.9.1: - version "0.9.1" - resolved "https://registry.yarnpkg.com/optionator/-/optionator-0.9.1.tgz#4f236a6373dae0566a6d43e1326674f50c291499" - integrity sha512-74RlY5FCnhq4jRxVUPKDaRwrVNXMqsGsiW6AJw4XK8hmtm10wC0ypZBLw5IIp85NZMr91+qd1RvvENwg7jjRFw== +optionator@^0.9.3: + version "0.9.4" + resolved "https://registry.yarnpkg.com/optionator/-/optionator-0.9.4.tgz#7ea1c1a5d91d764fb282139c88fe11e182a3a734" + integrity sha512-6IpQ7mKUxRcZNLIObR0hz7lxsapSSIYNZJwXPGeF0mTVqGKFIXj1DQcMoT22S3ROcLyY/rz0PWaWZ9ayWmad9g== dependencies: deep-is "^0.1.3" fast-levenshtein "^2.0.6" levn "^0.4.1" prelude-ls "^1.2.1" type-check "^0.4.0" - word-wrap "^1.2.3" + word-wrap "^1.2.5" p-limit@^3.0.2: version "3.1.0" @@ -865,7 +885,7 @@ strip-ansi@^6.0.1: dependencies: ansi-regex "^5.0.1" -strip-json-comments@^3.1.0, strip-json-comments@^3.1.1: +strip-json-comments@^3.1.1: version "3.1.1" resolved "https://registry.yarnpkg.com/strip-json-comments/-/strip-json-comments-3.1.1.tgz#31f1281b3832630434831c310c01cccda8cbe006" integrity sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig== @@ -937,10 +957,10 @@ which@^2.0.1: dependencies: isexe "^2.0.0" -word-wrap@^1.2.3: - version "1.2.3" - resolved "https://registry.yarnpkg.com/word-wrap/-/word-wrap-1.2.3.tgz#610636f6b1f703891bd34771ccb17fb93b47079c" - integrity sha512-Hz/mrNwitNRh/HUAtM/VT/5VH+ygD6DV7mYKZAtHOrbs8U7lvPS6xf7EJKMF0uW1KJCl0H701g3ZGus+muE5vQ== +word-wrap@^1.2.5: + version "1.2.5" + resolved "https://registry.yarnpkg.com/word-wrap/-/word-wrap-1.2.5.tgz#d2c45c6dd4fbce621a66f136cbe328afd0410b34" + integrity sha512-BN22B5eaMMI9UMtjrGd5g5eCYPpCPDUy0FJXbYsaT5zYxjFOckS53SQDE3pWkVoWpHXVb3BrYcEN4Twa55B5cA== wrappy@1: version "1.0.2" From d0aa126a2baabe139df8022028996b40f89fa52b Mon Sep 17 00:00:00 2001 From: Rodrigo Gomez Palacio Date: Wed, 18 Dec 2024 14:35:31 -0600 Subject: [PATCH 11/11] 3.0.1 Release Commit --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 67dd621..4fbfaf6 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "web-shim-codegen", - "version": "3.0.0", + "version": "3.0.1", "description": "Used to build Web SDK libraries for various web frameworks", "main": "index.js", "scripts": {