Skip to content

Instantly share code, notes, and snippets.

View enriquebeta6's full-sized avatar

Enrique Mora enriquebeta6

View GitHub Profile
@enriquebeta6
enriquebeta6 / package.json
Created July 25, 2024 21:56
Script for "add all the products to collection"
{
"name": "scripts",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"keywords": [],
"author": "",
import fs from 'fs'
async function init() {
let token = ''
const size = 1000
const schema = ''
const allDocuments = []
const accountName = ''
const fields = ['_all'].join(',')
const entity = ''
function getEntityNameAndSchemaOfMDV2({
appName,
vendor,
entity,
version,
workspace = '',
}) {
return {
entityName: `${vendor}_${appName}_${entity}`.replace(/(\.)|-|:|@/gi, "_"),
schema: [version, workspace].filter(Boolean).join('-'),
@enriquebeta6
enriquebeta6 / deleteAll.js
Last active February 15, 2024 17:09
MasterData Utils
async function deleteAll(entity) {
const sleep = (ms) => {
return new Promise((resolve) => {
setTimeout(resolve, ms)
})
}
while (true) {
const randomNumber = Math.ceil(Math.random() * 100000)
/* eslint-disable @typescript-eslint/explicit-member-accessibility */
/* eslint-disable import/order */
// Dependencies
import React from 'react'
type OrderForm = any
interface StateProviderState {
orderForm: OrderForm | null
}
// Depedencies
import React from 'react'
import { createPortal } from 'react-dom'
// Components
import ErrorBoundary from './ErrorBoundary'
interface SafePortalProps {
rootSelector: string
applyCleanup?: boolean
@enriquebeta6
enriquebeta6 / updateMarketingData.ts
Created July 5, 2022 18:19
Update the marketing data inside of VTEX OrderForm
// Dependencies
import Cookies from 'js-cookie'
// TODO: improve this typing
declare global {
interface Window {
vtexjs: {
checkout: {
orderForm: any;
getOrderForm: () => Promise<any>;